[R] recode vector values to NA
Uwe Ligges
ligges at statistik.uni-dortmund.de
Tue Mar 27 07:18:40 CEST 2001
"Patrick E. McKnight" wrote:
>
> Greetings,
>
> I'm in the painful process of migrating from SAS to R. In the process I've
> discovered that there are some basic things that I am getting hung up on. The
> most basic is the simple recoding of variables. Suppose I create a vector
>
> x <- rnorm(10000)
>
> and I want to recode all values of x > 1.5 to NA. How would I do that in R?
x[x > 1.5] <- NA
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list