Skip to content
Prev 10396 / 398513 Next

recode vector values to NA

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? 

TIA

Cheers,

Patrick

________________________________________________________________________
Patrick E. McKnight, Ph.D.
University of Arizona
Department of Psychology
Tucson, AZ  85721
pem at theriver.com

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._