Re: [R] Replacing 0s with NA

2009-06-12 Thread Gabor Grothendieck
Also try this: X[X == 0] <- NA or X2 <- replace(X, X == 0, NA) On Fri, Jun 12, 2009 at 5:54 AM, Chuck Cleland wrote: > On 6/12/2009 4:55 AM, Christine Griffiths wrote: >> Hello >> >> I have a dataset in which I would like to replace 0s with NAs. There is >> a lot of information on how to repla

Re: [R] Replacing 0s with NA

2009-06-12 Thread Gavin Simpson
On Fri, 2009-06-12 at 09:55 +0100, Christine Griffiths wrote: > Hello > > I have a dataset in which I would like to replace 0s with NAs. There is a > lot of information on how to replace NAs with 0, but I have struggled to > find anything with regards to doing the reverse. Any recommendations wo

Re: [R] Replacing 0s with NA

2009-06-12 Thread Chuck Cleland
On 6/12/2009 4:55 AM, Christine Griffiths wrote: > Hello > > I have a dataset in which I would like to replace 0s with NAs. There is > a lot of information on how to replace NAs with 0, but I have struggled > to find anything with regards to doing the reverse. Any recommendations > would be great.

[R] Replacing 0s with NA

2009-06-12 Thread Christine Griffiths
Hello I have a dataset in which I would like to replace 0s with NAs. There is a lot of information on how to replace NAs with 0, but I have struggled to find anything with regards to doing the reverse. Any recommendations would be great. Cheers Christine