summarize-plyr package

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

summarize-plyr package

Veerappa Chetty
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: [hidden email],[hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: summarize-plyr package

baptiste auguie-5
Hi,

it works for me with plyr version 0.1.9. Try upgrading to the latest
version, or post your sessionInfo()


HTH,

baptiste

2009/9/25 Veerappa Chetty <[hidden email]>:

> 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: [hidden email],[hidden email]
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: summarize-plyr package

Girish A.R.
In reply to this post by Veerappa Chetty
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@gmail.com,vchetty@bu.edu

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.