"object not found" within function
Thushyanthan Baskaran wrote:
Hi,
I am trying to write a function to compute many cross-tabulations with
the -svytable- command. Here is a simplified example of the structure of
my code (adapted from the -svytable- help file):
data(api)
func.example<-function(variable){ dclus1<-svydesign(id=~1,
weights=~pw,data=apiclus1, fpc=~fpc)
svytable(~ variable, dclus1)
}
When I call this function with:
func.example(api99)
What are api, api99, svytable, svydesign etc? Uwe Ligges
I get the following error: Error in eval(expr, envir, enclos) : object 'variable' not found. (Everything works fine when I type svytable(~ api99, dclus1).) I guess that the problem has something to do with function environments, but since I am new to R, I can't seem to figure out how to rectify the code. I am running R version 2.10 on Windows Vista. Thanks for the help! Thushyanthan
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.