R-使用扫描功能时出错

时间:2015-11-15 12:53:03

标签: r

代码如下,

> x<-rbind(matrix(rnorm(4,sd=0.3),ncol=2),matrix(rnorm(4,mean=1,sd=0.3),ncol=2))

> ww <- c(4,0)

> x1 <- x[,ww!=0]

> z<-sweep(x1,2,sqrt(ww[ww!=0]),"*")

Error in array(STATS, dims[perm]) : 'dims' cannot be of length 0

并且traceback()显示

> traceback()
3: array(STATS, dims[perm])
2: aperm(array(STATS, dims[perm]), order(perm))
1: sweep(x1, 2, sqrt(ww[ww != 0]), "*")

那么为什么会出现错误以及如何解决?

0 个答案:

没有答案
相关问题