Dear R communitiy,
I am trying to use multiple functions for aggregation within a function
call for dcast. However this seems to result in an error. Also I have not
managed to make dcast() work with fun.aggregate=sd. Please find attached
some example code using the ChickWeight data.
Many thanks for your help!
Jokel
#Chick weight example
names(ChickWeight) <- tolower(names(ChickWeight))
sd(ChickWeight$weight) # works fine
mean(ChickWeight$weight) # works fine
length(ChickWeight$weight) # works fine
chick_m <- melt(ChickWeight, id=2:4, na.rm=TRUE)
dcast(chick_m, time~variable, mean) # works fine
dcast(chick_m, time~variable, length) # works fine
dcast(chick_m, time~variable, fun.aggregate=sd) # gives an error
dcast(chick_m, time~variable, c(mean, length)) # gives an error
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.