Skip to content
Prev 12012 / 398502 Next

changing values

Thanks very much Dr. Ripley.

After thinking a little more on my question I decide to use "ifelse"

x <- c(x)
x1 <- ifelse (x <=2, 1, x)
x2 <- ifelse (x1>=3, 2, x1)
x <- factor(x2)

it works, but "levels(x) <- c(1,1,2,2)" is too much easier.

Thanks a lot.

Ant?nio Olinto

----- Original Message -----
From: "Prof Brian Ripley" <ripley at stats.ox.ac.uk>
To: "Antonio Olinto" <aolinto at bignet.com.br>
Cc: <r-help at stat.math.ethz.ch>
Sent: Thursday, June 28, 2001 11:34 AM
Subject: Re: [R] changing values
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._