| To: | Bill Osburn <bosburn@sjrwmd.com> |
|---|---|
| Subject: | Re: S-PLUS: na.omit on data.frame columns |
| From: | David L Lorenz <lorenz@usgs.gov> |
| Date: | Mon, 2 Feb 2009 13:20:47 -0600 |
| Cc: | "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>, s-news-owner@lists.biostat.wustl.edu |
| In-reply-to: | <9E9563D3FAECF9448B370F988FD6BD153A293695E4@MAILSVR.sjrwmd.com> |
| References: | <9E9563D3FAECF9448B370F988FD6BD153A293695E4@MAILSVR.sjrwmd.com> |
|
Bill, How about as.data.frame(lapply(DF, function(x) if(any(is.na(x))) NULL else x)) where DF is the name of your data.frame. Dave
I have a data.frame and want to remove all columns where there is an NA. So far I can only get na.omit to work on rows. After googling for several hours I still can’t locate any ideas. Has anyone done na.omit or something, on columns? With my current data.frame I should go from 16x78 to 16x28 |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | S-PLUS: na.omit on data.frame columns, Bill Osburn |
|---|---|
| Next by Date: | Re: S-PLUS: na.omit on data.frame columns, Sebastien Bihorel |
| Previous by Thread: | S-PLUS: na.omit on data.frame columns, Bill Osburn |
| Next by Thread: | Re: S-PLUS: na.omit on data.frame columns, Sebastien Bihorel |
| Indexes: | [Date] [Thread] [Top] [All Lists] |