Re: [R] replacing all NA's in a dataframe with zeros...

2007-03-15 Thread David L. Van Brunt, Ph.D.
in Google > (as US user) yielded some good results (5th and 7th entry), but there > was another example that explicitly yielded this technique. I can't > seem to recall my exact search string. > > > - Original Message - > From: "David L. Van Brunt, Ph.D.&quo

Re: [R] replacing all NA's in a dataframe with zeros...

2007-03-15 Thread Gavin Simpson
On Thu, 2007-03-15 at 10:21 +0100, Peter Dalgaard wrote: > Gavin Simpson wrote: > > On Wed, 2007-03-14 at 20:16 -0700, Steven McKinney wrote: > > > >> Since you can index a matrix or dataframe with > >> a matrix of logicals, you can use is.na() > >> to index all the NA locations and replace them

Re: [R] replacing all NA's in a dataframe with zeros...

2007-03-15 Thread Joerg van den Hoff
On Thu, Mar 15, 2007 at 10:21:22AM +0100, Peter Dalgaard wrote: > Gavin Simpson wrote: > > On Wed, 2007-03-14 at 20:16 -0700, Steven McKinney wrote: > > > >> Since you can index a matrix or dataframe with > >> a matrix of logicals, you can use is.na() > >> to index all the NA locations and repla

Re: [R] replacing all NA's in a dataframe with zeros...

2007-03-15 Thread Peter Dalgaard
Gavin Simpson wrote: > On Wed, 2007-03-14 at 20:16 -0700, Steven McKinney wrote: > >> Since you can index a matrix or dataframe with >> a matrix of logicals, you can use is.na() >> to index all the NA locations and replace them >> all with 0 in one command. >> >> > > A quicker solution, tha

Re: [R] replacing all NA's in a dataframe with zeros...

2007-03-15 Thread Gavin Simpson
y and Breast Cancer Program > British Columbia Cancer Research Centre > > email: [EMAIL PROTECTED] > > tel: 604-675-8000 x7561 > > BCCRC > Molecular Oncology > 675 West 10th Ave, Floor 4 > Vancouver B.C. > V5Z 1L3 > Canada > > > > > -Ori

Re: [R] replacing all NA's in a dataframe with zeros...

2007-03-14 Thread Steven McKinney
/14/2007 5:22 PM To: R-Help List Subject: [R] replacing all NA's in a dataframe with zeros... I've seen how to replace the NA's in a single column with a data frame *> mydata$ncigs[is.na(mydata$ncigs)]<-0 *But this is just one column... I have thousands of columns (!) that

Re: [R] replacing all NA's in a dataframe with zeros...

2007-03-14 Thread Jason Barnhart
--- From: "David L. Van Brunt, Ph.D." <[EMAIL PROTECTED]> To: "R-Help List" Sent: Wednesday, March 14, 2007 5:22 PM Subject: [R] replacing all NA's in a dataframe with zeros... > I've seen how to replace the NA's in a single column with a data >

[R] replacing all NA's in a dataframe with zeros...

2007-03-14 Thread David L. Van Brunt, Ph.D.
I've seen how to replace the NA's in a single column with a data frame *> mydata$ncigs[is.na(mydata$ncigs)]<-0 *But this is just one column... I have thousands of columns (!) that I need to do this, and I can't figure out a way, outside of the dreaded loop, do replace all NA's in an entire data