Re: [R] reshape/aggregate

2011-08-31 Thread Kai Megerle
thanks everybody! On Wed, Aug 31, 2011 at 5:03 AM, jim holtman wrote: > You can use data.table: > > > group <- c(rep('A', 8), rep('B', 15), rep('C', 6)) > > time <- c(rep(seq(1:4), 2), rep(seq(1:5), 3), rep(seq(1:3), 2)) > > value <- runif (29, 1, 10) > > dfx <- data.frame (group, time, value) >

Re: [R] : reshape/aggregate

2011-08-31 Thread Petr PIKAL
Hi > The plyr solution is: > > library(plyr) > ddply(dfx, .(group, time), summarize, mean = mean(value), sd = sd(value)) I tried to do the task by ddply but I had difficulties to understand the correct syntax. Maybe in next issue of plyr summarise could be referenced in ddply help page. Or

Re: [R] reshape/aggregate

2011-08-31 Thread jim holtman
You can use data.table: > group <- c(rep('A', 8), rep('B', 15), rep('C', 6)) > time <- c(rep(seq(1:4), 2), rep(seq(1:5), 3), rep(seq(1:3), 2)) > value <- runif (29, 1, 10) > dfx <- data.frame (group, time, value) > require(data.table) > dfx <- data.table(dfx) > dfx[, + list(mean = mean(value),

[R] reshape/aggregate

2011-08-31 Thread Kai Megerle
Hi all, I apologize for this probably stupid question, but I really can't figure it out. I have a dataframe like this: group <- c(rep('A', 8), rep('B', 15), rep('C', 6)) time <- c(rep(seq(1:4), 2), rep(seq(1:5), 3), rep(seq(1:3), 2)) value <- runif (29, 1, 10) dfx <- data.frame (group, time, value