Re: [R] Merging columns along time line

2010-07-14 Thread Wu Gong
Correction: b$label <- cut(b$timestamp, breaks=bks, labels=lbs, include.lowest = T, right=F) - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Merging-columns-along-time-line-tp2289147p2289401.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Merging columns along time line

2010-07-14 Thread Wu Gong
I take this case as cut a data set by breaks and assign each segment a label name. a <- data.frame(timestamp=c(3,5,8), mylabel=c("abc","def","ghi")) b <- data.frame(timestamp=c(1:10)) bks <- c(a$timestamp,max(b$timestamp)) lbs <- a$mylabel b$label <- cut(b$timestamp, breaks=bks, labels=lbs, inclu

[R] Merging columns along time line

2010-07-14 Thread Ralf B
I am resending this, as I believe it has not arrived on the mailing list when I first emailed. I have a set of labels arranged along a timeframe in a. Each label has a timestamp and marks a state until the next label. The dataframe a contains 5 such timestamps and 5 associated labels. This means,