Re: [R] Replacing NA values in one column of a data.frame

2009-08-18 Thread John Kane
Clearly the poor user needs to export something to one of those archaic stats systems like SAS or SPSS :) --- On Tue, 8/18/09, Bert Gunter wrote: > From: Bert Gunter > Subject: RE: [R] Replacing NA values in one column of a data.frame > To: "'Steve Lianoglou'" , &

Re: [R] Replacing NA values in one column of a data.frame

2009-08-18 Thread Bert Gunter
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Steve Lianoglou Sent: Tuesday, August 18, 2009 7:25 AM To: John Kane Cc: r-help@r-project.org; Steve Murray Subject: Re: [R] Replacing NA values in one column of a data.frame

Re: [R] Replacing NA values in one column of a data.frame

2009-08-18 Thread John Kane
OOPs clumsy cut and paste. :( --- On Tue, 8/18/09, Uwe Ligges wrote: > From: Uwe Ligges > Subject: Re: [R] Replacing NA values in one column of a data.frame > To: "John Kane" > Cc: r-help@r-project.org, "Steve Murray" > Received: Tuesday, August 18, 200

Re: [R] Replacing NA values in one column of a data.frame

2009-08-18 Thread Steve Lianoglou
Hi, On Aug 18, 2009, at 10:19 AM, John Kane wrote: Perhaps testdata$onecolumn[testdata$onecolumn==NA] <- I don't think this would work -- the is.na function is the way to go: R> a <- c(1,2,3,NA,NA,10,20,NA,NA) R> a [1] 1 2 3 NA NA 10 20 NA NA R> a[a == NA] <-999 R> a [1] 1 2 3 NA

Re: [R] Replacing NA values in one column of a data.frame

2009-08-18 Thread Uwe Ligges
John Kane wrote: Perhaps testdata$onecolumn[testdata$onecolumn==NA] <- Well, with is.na() there is a much better chance to make it work Uwe Ligges --- On Mon, 8/17/09, Steve Murray wrote: From: Steve Murray Subject: [R] Replacing NA values in one column of a data.frame To: r-h

Re: [R] Replacing NA values in one column of a data.frame

2009-08-18 Thread John Kane
Perhaps testdata$onecolumn[testdata$onecolumn==NA] <- --- On Mon, 8/17/09, Steve Murray wrote: > From: Steve Murray > Subject: [R] Replacing NA values in one column of a data.frame > To: r-help@r-project.org > Received: Monday, August 17, 2009, 11:41 AM > > Dear all, > > I'm trying to re

Re: [R] Replacing NA values in one column of a data.frame

2009-08-18 Thread jim holtman
testdata[is.na(testdata$onecolumn)] <- - On Mon, Aug 17, 2009 at 11:41 AM, Steve Murray wrote: > > Dear all, > > I'm trying to replace NA values with - in one column of a data frame. > I've tried using is.na and the testdata[testdata$onecolumn==NA] <- > approach, but whilst neither