seq - Assign times to 10 minute interval group in r -


i attempting "cut" data frame according times (by 10 min).

dat <- read.table(text="time 4:30:08 3:37:00 pm 5:15:38 pm 5:16:41 pm 5:17:05 pm 5:17:25 pm 5:48:48 pm", header=true, sep="\t") 

i want this:

time        group 4:30:08  4:30 3:37:00 pm  3:30 5:15:38 pm  5:10 5:16:41 pm  5:10 5:17:05 pm  5:10 5:17:25 pm  5:10 5:48:48 pm  5:50 

thanks!

using edit input made question:

> dat$group <- paste0(substr(dat$time,1,3), "0") > dat         time group 1 4:30:08  4:30 2 3:37:00 pm  3:30 3 5:15:38 pm  5:10 4 5:16:41 pm  5:10 5 5:17:05 pm  5:10 6 5:17:25 pm  5:10 7 5:48:48 pm  5:40 

admittedly don't know sure data looks thought unlikely poster had in actual r datetime or time class. @ least may provoke clarification.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -