[R] couldn't find function "..."

Steve Arthur sarthur at crick.protogene.com
Thu Jul 6 00:38:30 CEST 2000


Hi,

R 1.0.1, on Linux(mandrake/RedHat).

I am trying to write my first function using R and I need help figuring
out the error I have indicated in the Subject line above.  The purpose
of the function is not to "wow" anyone, but just to serve as a stepping
stone so that I might write more complicated functions in the future.

First I created my function named "CIfunc" and saved into the current
directory using the "save" command.

function(Mean, SD, N, Sig) {

   if (N > 30) { Zscore <- pnorm(Sig)} else {Zscore <- pt(Sig,N-1)}
   Zscore

   UpperCI <- Mean + Zscore * SD / sqrt(N)
   UpperCI

   LowerCI <- Mean - Zscore * SD / sqrt(N)
   LowerCI

}

...with no error.

Next I write the function call "testcall":

testcall <- call('CIfunc', prescan10$F532Mean, prescan10$F532SD,
prescan10$FPixels, 0.95)

...with no error.

testcall CIfunc(c(189, 238, 363, 869, 585, 350, 3624, 290, 436, 517),
c(63, 58, 66, 127, 78, 46, 1452, 72, 83, 55), c(120, 120, 120, 120, 120,
120, 120, 120, 120, 120), 0.95)

But when I try to evaluate the function "CIfunc":

eval(testcall)

I get the error:

"Error in eval(expr, envir, enclos) : couldn't find function "CIfunc""

As I understand it, I saved the "CIfunc" in the directory I opened R from.

Do I need to set an environment variable to use functions in R?

steve 



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list