could not find functions?

4 replies [Last post]
cvanhulle's picture
Offline
Joined: 05/07/2010

I'm trying to use a couple of nifty functions that I cribbed from a script from the Twin Workshop. When I try to use
formatOutputMatrices or tableFitStatistics I get an error message saying R "could not find function".

Suggestions?

Thanks,
Carol

tbates's picture
Offline
Joined: 07/31/2009
Hi Carol, Those functions and

Hi Carol,
Those functions and others are in a helper file (i.e., not part of OpenMx) called "GenEpiHelperFunctions.R"
To access them you need to
1. Have a copy of the file. Yyou can grab a copy here for example: http://ibg.colorado.edu/cdrom2010/bartels/MultivariateTwinAnalysis

2. load it into R using the source() function.
source("GenEpiHelperFunctions.R")

For this to work the helper file needs to reside in your current working directory (which you can see by typing
getwd() and can set with setwd() (or cmd-D in OS X)

cvanhulle's picture
Offline
Joined: 05/07/2010
Wow. You guys are fast!

Wow. You guys are fast! Thanks. Which file is better, the one from the workshop or the one from here http://openmxhelpers.googlecode.com/svn/trunk/genEpi.lib.R

Thank you very much,

Carol

tbates's picture
Offline
Joined: 07/31/2009
I think they are the same

I think they are the same (you could compare them). Really the advice differs only in whether you need to be online to pull th file in over a URL.
With un-supported files like that, though they are a great convenience, you should look through each function to ensure you know what is happening behind the scenes, and ensure it is what you want/expect.

best,
t

mspiegel's picture
Offline
Joined: 07/31/2009
One option is to use the

One option is to use the following line in your script:
source("http://www.vipbg.vcu.edu/~vipbg/Tc24/GenEpiHelperFunctions.R")

Another option is to see if the mxCompare() function does what you want. See ?mxCompare. That function is maintained by the development team. I'm not sure whether the Gen Epi Helper Functions are maintained.