Re: [R] Arrange values on a timeline

2010-07-14 Thread Remko Duursma
Try this: a <- data.frame(timestamp=c(3,5,8), mylabel=c("abc","def","ghi")) b <- data.frame(timestamp=c(1:10)) txt <- as.character(a$mylabel) nrepeat <- diff(c(a$timestamp,nrow(b))) b$mylabel <- c( rep(NA, a$timestamp[1]), rep(txt, diff(c(a$timestamp,nrow(b ) greetings, Remko --

[R] Arrange values on a timeline

2010-07-13 Thread Ralf B
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, on a continious scale between 1-100, there are 5 markers. E.g. 'abc' marks the timestampls betwe