Hi List, I have start and end times of events
structure(list(start = c("15:00", "15:00", "15:00", "11:00", "14:00", "14:00", "15:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00", "12:00"), end = c("16:00", "16:00", "16:00", "12:00", "16:00", "15:00", "16:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00", "13:00")), .Names = c("start", "end"), row.names = c(NA, 20L), class = "data.frame") and I would like the data to look like this:
t9 t10 t11 t12 t13 t14 t15 t16 t17 1 FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE 2 FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE 3 FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE 4 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE 5 FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE 6 FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE 7 FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE 8 FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE 9 FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE 10 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
Which means, that I just get a TRUE for every hour the event was taking place. A finishing time of 16:00 means that t16 is FALSE, because the event was finished until 16:00; 16:15 as end time would result in t16 being TRUE. It would be nice if the function would add the variables needed (t9 ..) as well and depending on the times put in (no t9 if there is no event starting before 10:00).
Thanks for any suggestion, Stefan ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.