[R] Running stats on individual data.frames from the split() function list
Eric Vander Wal
eric.vanderwal at usask.ca
Tue Jun 16 22:44:15 CEST 2009
Hello, and thanks in advance.
I have a data.frame from which I want to count observations that occur
on each day and determine the mean and std.error of said counts.
For instance:
x<-split(my.df, my.df$julian.days)
Although I'm still in my R learning infancy I am under the impression
that x is a list of data.frames subsetting my.df by group
(i.e.,julian.day) where day 1:366 are x$'1': x$'366' and my variables
are x$'1'$var1, x$1$var2, for each data.frame in the list.
The data I seek can be supplied by
mean(sapply(split(x$'1'$var1, x$'1'$var2), length)) and
std.error(sapply(split(x$'1'$var1, x$'1'$var2), length)), etc.
Is there an efficient means for me to process the entire list x so that
I needn't call each data.frame (i.e., day) from list x individually? No
doubt there is a more sophisticated way to obtain this information from
the outset, but I'm not yet familiar with it.
Thanks again for all the help,
Eric
--
Eric Vander Wal
Ph.D. Candidate
University of Saskatchewan, Department of Biology,
112 Science Place, Saskatoon, SK., S7N 5E2
"Pluralitas non est ponenda sine neccesitate"
More information about the R-help
mailing list