Does A$TIME <- ifelse( A$TIME >= 24, A$TIME + 24, A$TIME )
what you want? Rgds, Rainer On Wednesday 21 November 2012 09:05:39 york8866 wrote: > Hi all, > > I had a dataset A like: > > TIME DV > 0 0 > 1 10 > 5 20 > 24 30 > 36 80 > 48 60 > 72 15 > > I would like to add 24 to those values higher than 24 in the TIME column. > > I did the following: > > If (A$TIME>=24) { > A$TIME <- A$TIME+24} > > It did not work. How should I do it? > > Thanks, > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/help-with-if-statement-tp4650315.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. ______________________________________________ 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.