Correct use of the following functions: describeBy, statsBy and stat.desc
I am using R 3.2.0 and have used the function successfully aggregate
, but it gives minimal statistics, tapply
gives more than the aggregate function, but the aggregate statistics are limited. For the following data from 4 different groups ns can anyone show me how to use the following functions: describeBy
, statsBy
and stat.desc
? Below is the data and wrong syntax for the above functions that I have used.
data <- c(62, 60, 63, 59, 63, 67, 71, 64, 65, 66, 68, 66, 71, 67, 68, 68, 56, 62, 60, 61, 63, 64, 63, 59)
grp <- factor(rep(LETTERS[1:4], c(4,6,6,8)))
df <- data.frame(group=grp, dt=data)
describeBy(data, df$dt, df$group, mean,median,min,max,sd)
statsBy(df,mean,median,min,max,sd)
stat.desc(df,basic=F)
+3
source to share
1 answer