[R] Replacing values

John Kane jrkrideau at yahoo.ca
Tue Dec 19 16:33:42 CET 2006


--- downunder <larsfromspace at web.de> wrote:

> 
> Hi all,
> 
> I have to recode some values in a dataset. for
> example changing all zeros to
> "." or 999 would be also ok. does anybody know how
> to do this? thanks in
> advance. lars

Hi Lars.
Marc has warned you about . 999 vs NA 

A couple of approachs:
aa <- c(2,3,5,7,7, 3)
aa[aa==7] <- 5
aa

or
library(car)
?recode



More information about the R-help mailing list