DT<-data.frame(time=c(0,1,5,24,36,48,72),DV=seq(0,60,10)) time DV 1 0 0 2 1 10 3 5 20 4 48 30 5 84 40 6 96 50 7 120 60 You want to add 24 to values that are >=24 in 'time'
DT[DT$time>=24,'time']<-DT[DT$time>=24,'time']+24 time DV 1 0 0 2 1 10 3 5 20 4 48 30 5 60 40 6 72 50 7 96 60 Is this what you were looking for? A. -- View this message in context: http://r.789695.n4.nabble.com/help-with-if-statement-tp4652015p4652055.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.