各位大佬,这个问题困扰我半个月了,我们不写程序的时候可以轻松生成调查数据
library(survey)
data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat)
但是一写成程序就不行了,我想在aaa这个程序运行的时候,在程序内部自己生成dstrat这个调查数据,但是怎么弄都不成功
aaa<-function(id,strata,weights,data) {
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat)
dstrat
}
aaa(id=1,strata="stype",weights="pw",data=apistrat)
恳请各位大佬闲暇之余指教一下