[R] Svy function doesn't work nested in user-defined function
Sabatier, Jennifer F. (CDC/OID/NCHHSTP)
fvv9 at cdc.gov
Thu May 20 17:24:19 CEST 2010
Hi R-help,
I posted about this late yesterday but got no response. I may have put
TMI in the original request. Not to mention I couldn't cut and paste
yesterday because I was working R off a non-network computer while
asking for help on a network computer.
Essentially, I have this user-defined function:
test <- function(X){
chisq <- svychisq(~X + SEX, design=audit,
statisic="adjWald", round=4)
}
test(con)
"con" is a data variable in my design object audit.
When I just run:
chisq <- svychisq(~X + SEX, design=audit, statisic="adjWald", round=4)
It works just fine.
It's only when it's nested in the function test() that it falls apart.
I get this error:
Error in `[.data.frame`(design$variables, , as.character(rows)) :
undefined columns selected
How can I solve this problem?
Thanks,
Jen (obviously a new R-user, as of late 2009)
More information about the R-help
mailing list