【发布时间】:2015-05-11 16:29:04
【问题描述】:
while 循环中可能有一些线程,但我正在努力解决它们。如果有人可以帮助 R 初学者,那就太好了。
所以我尝试使用预测参数从样本外回归预测中进行 10000 次模拟:均值、标准差。还好我的数据正常。
这就是我所拥有的
N<-10000
i<-1:N
k<-vector(,N)
while(i<N+1){k(,i)=vector(,rnorm(N,mean=.004546,sd=.00464163))}
...我收到此错误
Error in vector(, rnorm(5000, mean = 0.004546, sd = 0.00464163)) :
invalid 'length' argument
In addition: Warning message:
In while (i < N + 1) { : the condition has length > 1 and only the first element will be used
我似乎无法理解它。
【问题讨论】:
标签: r for-loop while-loop