Skip to content
Prev 275315 / 398506 Next

binning runtimes

Hi:
On Mon, Oct 24, 2011 at 2:01 AM, Giovanni Azua <bravegag at gmail.com> wrote:
If necessary, create a variable for minute; if Time already represents
minutes, you shouldn't need to do anything. To average Runtime by one
or more factors, there are many ways to do it: aggregate() in base R,
ddply() in plyr, summaryBy() in the doBy package or data.table. For
example, with aggregate() [R-2.11.0 or later], you could do (assuming
Time is in minutes; otherwise substitute the minute variable instead)

aggregate(Runtime ~ Time + Partitioning, data = dfs, FUN = mean)
# Example:
# sampfun() samples one row of a data frame at random
sampfun <- function(d) d[sample(seq_len(nrow(d)), 1), ]
library('plyr')
ddply(dfs, .(Time, Partitioning), sampfun)


HTH,
Dennis