[英]Example from ?aggregate documentation generates error
为什么这对我不起作用:
我从R帮助中粘贴了以下示例:
aggregate(. ~ Species, data = iris, mean)
我每次都收到以下错误
Error in m[[2L]][[2L]] <- parse(text = lhs)[[1L]] :
object of type 'symbol' is not subsettable
但是,以下工作原理:
aggregate(len ~ ., data = ToothGrowth, mean)
惊讶...
编辑:提供了会话信息
> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] splines stats graphics grDevices utils datasets methods base
other attached packages:
[1] doBy_4.4.0 MASS_7.3-11 snow_0.3-6 lme4_0.999375-39 Matrix_0.999375-46 lattice_0.19-17
[7] multcomp_1.2-6 mvtnorm_0.9-96 R2HTML_2.2 survival_2.36-5 reshape_0.8.4 plyr_1.4
[13] rcom_2.2-3.1 rscproxy_1.3-1 Biostrings_2.18.4 IRanges_1.8.9
loaded via a namespace (and not attached):
[1] Biobase_2.10.0 grid_2.12.2 nlme_3.1-98 stats4_2.12.2 tools_2.12.2
这个问题已部分解决。 我使用了一个新的R会话,粘贴了代码并得到了我想要的。 可能是程序包或我在会话中定义的内容引起问题(我不知道),如此处建议所见。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.