求一个矩阵每一列的标准差,为什么不能用for语句将每一个标准差循环4941次呢?
sd(x[,1])
for(i in 1:13514) sn = function(i){
sn = sd(x[,i])
return(sn)
}
sf <- rep(sn(1:13514),each = 4941)
一直出现这样的提醒
Error in is.data.frame(x) :
(list) object cannot be coerced to type 'double'
Called from: is.data.frame(x)
Browse[1]>