[R] Merging columns along time line

Wu Gong wg2f at mtmail.mtsu.edu
Wed Jul 14 23:16:13 CEST 2010


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, include.lowest = T,
right=T)

-----
A R learner.
-- 
View this message in context: http://r.789695.n4.nabble.com/Merging-columns-along-time-line-tp2289147p2289395.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list