[R] if negative value, make zero

ecvetano at uwaterloo.ca ecvetano at uwaterloo.ca
Fri May 28 17:37:08 CEST 2010

I have a data frame with both positive and negative values, and I want  
to make all the negative values equal zero, so i can eventually take  
an average.
I've tried
temp2 <- ifelse(tempr<0, 0, tempr)
but it doesn't seem to work.

Any suggestions?


More information about the R-help mailing list