我正在尝试在update
对象上使用survey.design
函数。例如,我想创建一个变量,它是4个其他变量的平均值,如下所示
x1<-runif(3)
x2<-runif(3)
x3<-runif(3)
population=10000
testdf<-data.frame(x1,x2,x3,population)
testsvy<-svydesign(id=~1,weights=c(30,30,30),data=testdf)
testsvy<-update(testsvy,avg=mean(c(x1,x2,x3)))
然而,这会为每个人返回相同数字的向量。一定有什么不对劲。或者我可以在test$variables
上进行修改,但我觉得这不是最简单的方法......
答案 0 :(得分:0)
好的,我自己得到了答案...希望它可以更简单,因为我输入三次对象名称......
Uncaught ReferenceError: kendo is not defined
at TreeView.componentDidMount (bundle.js:69556)
at commitLifeCycles (bundle.js:12471)
at commitAllLifeCycles (bundle.js:14142)
at HTMLUnknownElement.callCallback (bundle.js:2787)
at Object.invokeGuardedCallbackDev (bundle.js:2825)
at invokeGuardedCallback (bundle.js:2874)
at commitRoot (bundle.js:14281)
at completeRoot (bundle.js:15189)
at performWorkOnRoot (bundle.js:15139)
at performWork (bundle.js:15057)
bundle.js:12330 The above error occurred in the <TreeView> component:
in TreeView (created by AssetsStatusTreeView)
in div (created by AssetsStatusTreeView)
in AssetsStatusTreeView (created by Connect(AssetsStatusTreeView))
in Connect(AssetsStatusTreeView) (created by Route)
in Route
in Switch
in Router (created by BrowserRouter)
in BrowserRouter
in Provider
Uncaught TypeError: Cannot read property 'call' of undefined
at TreeView.KendoBaseComponent.componentWillUnmount (bundle.js:69569)
at callComponentWillUnmountWithTimer (bundle.js:12390)
at HTMLUnknownElement.callCallback (bundle.js:2787)
at Object.invokeGuardedCallbackDev (bundle.js:2825)
at invokeGuardedCallback (bundle.js:2874)
at safelyCallComponentWillUnmount (bundle.js:12397)
at commitUnmount (bundle.js:12643)
at unmountHostComponents (bundle.js:12986)
at commitDeletion (bundle.js:13016)
at commitAllHostEffects (bundle.js:14100)