[R] Removing columns that are all NA from a matrix

2008-02-14 Thread Martin Waller
Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs are fine). How please? Thanks, Martin

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Gabor Csardi
data - data[ , !apply(is.na(data), 2, all)] (or something like that) G. On Thu, Feb 14, 2008 at 12:59:46PM +, Martin Waller wrote: Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Chuck Cleland
On 2/14/2008 7:59 AM, Martin Waller wrote: Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs are fine). How please?

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Dimitris Rizopoulos
, 2008 1:59 PM Subject: [R] Removing columns that are all NA from a matrix Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs

Re: [R] Removing columns that are all NA from a matrix

2008-02-14 Thread Ted Harding
On 14-Feb-08 12:59:46, Martin Waller wrote: Hi, I guess this might be a FAQ or something, and there's probably a nice simple way to do it, but I can't think of it: Given a matrix, I want to remove columns that are _entirely_ filled with NAs (partial NAs are fine). How please? Thanks,