chipmaney
2009-Jul-17 21:22 UTC
[R] How do I run the by function on an object of class "by"???
I wrote a function with some loops and avoided a third loop by using the "by" function. The output object is an array (or list) of class "by" that looks like this:>StationCover.dfEmpirical.df$Quadrat: VFFF9-21 Station Shrub Tree Woody Invasive Herb Litter Bare [1,] 0.0 1 1 1 0 0 0 0 Empirical.df$Quadrat: VFFF9-22 Station Shrub Tree Woody Invasive Herb Litter Bare [1,] 0.0 1 1 1 0 0 0 0 Empirical.df$Quadrat: VFFF9-23 Station Shrub Tree Woody Invasive Herb Litter Bare [1,] 0.0 1 1 1 0 0 0 0 etc etc..... basically, i want to use this output object, StationCover.df as a data object for another by() function. However, I get the following error:> by(StationCover.df,Quadrats.df,TotalCover)Error in as.data.frame.default(data) : cannot coerce class "by" into a data.frame So, obviously I need to extract data.frames from my original by() function output, StationCover.df for use in other functions. Any suggestions on the quickest way to do this? -- View this message in context: http://www.nabble.com/How-do-I-run-the-by-function-on-an-object-of-class-%22by%22----tp24541893p24541893.html Sent from the R help mailing list archive at Nabble.com.