1

I'm guessing mlply should be used here for the equivalent of what I'm doing in mapply, but I'm not able to figure out how. I really would like to understand the plyr package better.

df <- data.frame(start=as.Date(c("2012-01-01","2012-02-02")),end=as.Date(c("2012-01-04","2012-02-08")))
l <- mapply(function(x,y) seq(x,y,by="day"),df$start, df$end)

Thanks in advance, --JT

JimmyT
  • 1,099
  • 4
  • 10
  • 15

1 Answers1

3

I think the big difference if that you need to name your function arguments in line with the variable names in your data frame:

mlply(df,function(start,end){seq(start,end,by = "day")})
joran
  • 169,992
  • 32
  • 429
  • 468