[R] summarize-plyr package
Girish A.R.
garamach at gmail.com
Fri Sep 25 16:31:27 CEST 2009
Works alright for me:
> summarise(baseball,duration = max(year) - min(year),nteams =
> length(unique(team)))
duration nteams
1 136 132
> ddply(baseball, "id", summarise, duration = max(year) - min(year), nteams
> = length(unique(team)))
id duration nteams
1 aaronha01 22 3
2 abernte02 17 7
3 adairje01 12 4
4 adamsba01 20 2
5 adamsbo03 13 4
....
....
cheers,
-Girish
> sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
base
other attached packages:
[1] RWinEdt_1.8-1 gtools_2.6.1 gmodels_2.15.0 ggplot2_0.8.3
reshape_0.8.3
[6] plyr_0.1.9 proto_0.3-8 doBy_4.0.2
loaded via a namespace (and not attached):
[1] cluster_1.12.0 Formula_0.1-3 gdata_2.6.1 Hmisc_3.7-0
kinship_1.1.0-23
[6] lattice_0.17-25 MASS_7.2-48 nlme_3.1-94 plm_1.1-4
sandwich_2.2-1
[11] splines_2.9.2 survival_2.35-7 tools_2.9.2
-------------------------------------------------------------
Veerappa Chetty wrote:
>
> Hi,I am using the amazing package 'plyr". I have one problem. I would
> appreciate help to fix the following error: Thanks.
> ______________________________
>
>> library(plyr)
>> data(baseball)
>> summarise(baseball,
> + duration = max(year) - min(year),
> + nteams = length(unique(team)))
> Error: could not find function "summarise"
>> ddply(baseball, "id", summarise,
> + duration = max(year) - min(year),
> + nteams = length(unique(team)))
> Error in llply(.data = .data, .fun = .fun, ..., .progress = .progress) :
> object "summarise" not found
> --------------------------------------------
>
> --
> Professor of Family Medicine
> Boston University
> Tel: 617-414-6221, Fax:617-414-3345
> emails: chettyvk at gmail.com,vchetty at bu.edu
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/summarize-plyr-package-tp25612974p25613167.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list