John Clark
John Clark

Reputation: 2769

Example from ?aggregate documentation generates error

Why is this not working for me:

I pasted in the following example from R help:

aggregate(. ~ Species, data = iris, mean)

I am getting following error every time

Error in m[[2L]][[2L]] <- parse(text = lhs)[[1L]] : 
  object of type 'symbol' is not subsettable

However the following works:

aggregate(len ~ ., data = ToothGrowth, mean)

Surprised ...

Edits: session information is provided

> 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 

Upvotes: 1

Views: 256

Answers (1)

John Clark
John Clark

Reputation: 2769

This question is partially solved. I used a fresh R session, pasted code and got what I want. Potentially the package or something I define in the session are causing problem ( I do not know), as suggested here see prov.

Upvotes: 1

Related Questions