A really elegant solution for combining different summary results:
library(plyr)
mtcars$mpg_g <- cut(mtcars$mpg, breaks=seq(from=10, to=35, by=5))
d.res <- ddply(mtcars, c("cyl", "am"), summarize,
anz = length(cyl),
min.hp=min(hp), med.hp=median(hp), mean.hp=round(mean(hp),2), max.hp=max(hp),
mpg_g=matrix(table(mpg_g), nrow=1))
d.res
Credits to Markus Naepflin (2014) for that.
Montag, 27. Januar 2014
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen