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?
>
>
MAIL PROTECTED]>
Sent: Thursday, February 14, 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,
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?
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
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
___
5 matches
Mail list logo