为什么这对我不起作用:
我在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
答案 0 :(得分:1)
这个问题已部分解决。我使用了新的R会话,粘贴代码并得到了我想要的东西。我在会话中定义的包或其他东西可能导致问题(我不知道),如此处所示,参见prov。