Try
as.data.frame(as.table(a))
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.berkeley.edu
On Thu, 3 Feb 2011, Graves, Gregory wrote:
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube <ddube-at-advisen.com> wrote:
i use tapply and by often, but i always end up banging my head against
the wall with the output.
The proposed solution of Dan's problem posted on R-help was:
do.call(rbind,a)
When I use this 'solution' I get 'ERROR: second argument must be a list'. So
head on wall continues.
My tapply output is generated as follows:
a=tapply(value,list(sampling.date,station.code),mean)
which gives me this (in part):
A B C D E F G H I J K
1/15/2008 0.004 0.027 0.019 0.015 0.035 0.022 0.007 0.038 0.042 0.045 0.0350
1/15/2009 0.027 0.027 0.031 0.015 0.008 0.021 0.007 0.027 0.026 0.029 0.0210
1/15/2010 0.016 0.020 0.015 0.022 0.015 0.013 0.007 0.014 0.019 0.019 0.0180
10/15/2007 0.052 0.051 0.032 0.024 0.017 0.044 0.015 0.058 0.063 0.061 0.0640
10/15/2008 0.042 0.054 0.030 0.017 0.024 0.030 0.019 0.044 0.047 0.051 0.0390
10/15/2009 0.047 0.035 0.031 0.020 0.012 0.039 0.019 0.051 0.055 0.054 0.0350
The only way I can figure out how to resolve this, such that I can, for example, plot
station "A" against date, is to export the tapply output as a csv, and then
reimport.
Suggestions? I couldn't find a solution to this likely SIMPLE problem in
Crawley or multiple searches of R help.
Gregory A. Graves, Lead Scientist
Everglades REstoration COoordination and VERification (RECOVER)
Wetland Watershed Sciences / Restoration Sciences Department
South Florida Water Management District
Phones: DESK: 561 / 682 - 2429
CELL: 561 / 719 - 8157
______________________________________________
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.
______________________________________________
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.