Re: [R] pruning data

2009-09-02 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Payam Minoofar > Sent: Wednesday, September 02, 2009 10:09 AM > To: r-help@r-project.org > Subject: [R] pruning data > > Hello everyone, > > I a

Re: [R] pruning data

2009-09-02 Thread Phil Spector
Payam - Take a look at na.omit . This is exactly what it was written for. - Phil On Wed, 2 Sep 2009, Payam Minoofar wrote: Hello everyone, I am trying to prune a data frame for partial least squares analysis. I need to delete an entire row if one cell i

Re: [R] pruning data

2009-09-02 Thread Henrique Dallazuanna
Try this: DF[complete.cases(DF),] On Wed, Sep 2, 2009 at 2:09 PM, Payam Minoofar wrote: > Hello everyone, > > I am trying to prune a data frame for partial least squares analysis. > I need to delete an entire row if one cell in the row contains a NA. > > Presently, I am running a loop that is su

Re: [R] pruning data

2009-09-02 Thread Jorge Ivan Velez
Dear Payam, Here is a suggestion: index <- apply(yourdata, 1, function(x) any( is.na(x) ) ) yourdata[ !index, ] Above creates an index (TRUE) when any row of the data contains a missing value. Then it filters up (extract) the rows that have complete observations. See ?any, ?is.na, ?"!" and ?appl

Re: [R] pruning data

2009-09-02 Thread stephen sefick
?is.na ?sum ?if ?else I think that is how I would approach it, but I could be far off. On Wed, Sep 2, 2009 at 12:09 PM, Payam Minoofar wrote: > Hello everyone, > > I am trying to prune a data frame for partial least squares analysis. > I need to delete an entire row if one cell in the row contain

[R] pruning data

2009-09-02 Thread Payam Minoofar
Hello everyone, I am trying to prune a data frame for partial least squares analysis. I need to delete an entire row if one cell in the row contains a NA. Presently, I am running a loop that is supposed to extract the rows that are full of numbers into a second data frame and skips the rows