Thankyou everyone for the assistance with my subsetting question. I was
trying to avoid posting a second request in as many hours, but... Here
goes anyway...
I managed to subset my data in a satisfactory manner, now I am trying to
produce a final dataframe that contains means in all numerical columns
by species. The trouble is, there are several columns with "factor"
data that I don't want to loose. If I use aggregate() like this:
> eb.df <-
aggregate(E111BioconData.acan.grwth.df[,50:58],list(Species=E111BioconData.acan.grwth.df$Species),
mean)
it works only because columns 50:58 are numeric, but I loose a column
that contains factor mode info. If I try the same thing on all the data
(attempting to preserve column 9 which contains factor data), Like this:
> eb.df <- aggregate(E111BioconData.acan.grwth.df[,1:58],list(Species=
+ E111BioconData.acan.grwth.df$Species), mean)
I get the error,
"There were 50 warnings (use warnings() to see them) Problem in
data.frameAux.list(x, na.strings = na.str..: Object "n" not found Use
traceback() to see the call stack"
Which I believe is because several of the columns contain factor data
and I can't use mean() on factor data. Does anyone know a trick to
perform a aggregation on multiple columns of numeric data while
preserving several columns of factor data?
Thanks again,
Kirk
-----------------------------------------------------------------------
Kirk R. Wythers University of Minnesota
kwythers@lorax.forestry.umn.edu Department of Forest Resources
tel: 612.625.2261 1530 Cleveland Ave. N.
fax: 612.625.5212 Saint Paul, MN 55108
-----------------------------------------------------------------------
|