Displaying 2 results from an estimated 2 matches for "dietox12".
Did you mean:
dietox
2010 Mar 17
2
Using nrow with summaryBy
...niformly distributed) using summaryBy and trying
to add a column with the number of observations to the output as well.
What occurs to me is to use nrow(), but this doesn't appear to be working
I'm able to replicate the same results with an example from the
summaryBy docs:
data(dietox)
dietox12<- subset(dietox,Time==12)
library(doBy)
#this one works
summaryBy(Weight+Feed~Evit+Cu,data=dietox12,FUN=c(mean,var,length))
#adding nrow doesn't give the number of rows
summaryBy(Weight+Feed~Evit+Cu,data=dietox12,FUN=c(mean,var,length,nrow))
There must be a way to do this, but I can't...
2005 Jul 12
4
Calculation of group summaries
I know R has a steep learning curve, but from where I stand the slope
looks like a sheer cliff. I'm pawing through the available docs and
have come across examples which come close to what I want but are
proving difficult for me to modify for my use.
Calculating simple group means is fairly straight forward:
data(PlantGrowth)
attach(PlantGrowth)
stack(mean(unstack(PlantGrowth)))