大家好,有谁知道这个问题怎么解决吗。
> dstats <- function(x)(c(mean=mean(x), sd=sd(x)))
> by(mtcars[vars],mtcars$am, dstats)
Error in is.data.frame(x) :
(list) object cannot be coerced to type 'double'
In addition: Warning message:
In mean.default(x) : argument is not numeric or logical: returning NA
我看R语言实战上面也这么写的。能运行出结果,我的不知道什么问题……有会的,帮忙解答下,谢谢喽!