[R] How to use groupedData() within a function?

John_Zhong@hgsi.com John_Zhong at hgsi.com
Mon Jul 24 17:21:11 CEST 2000


Dear Group:

I have been trying to write an R function within which the function
groupedData() would be used.
The following is a sample program:

#######################

sid<-rep(1:6,times=2)
time<-c(1:12)
trt<-rep(letters[1:3],times=4)
tem<-data.frame(sid,time,trt)

test1.fun<- function(dat=dat)
{
  groupedData(time ~ trt|sid, data=dat)
}

test1.fun(dat=tem)
########################

However, when I ran this kind of program in R, I got the following error
message:

Error in as.character(table) : Object "dat" not found.

Could anyone please help me specify the parameters in the function
groupedData() so that it would
work within my self-created local function?

Thanks.

John

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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