Skip to content
Back to formatted view

Raw Message

Message-ID: <23796761.post@talk.nabble.com>
Date: 2009-05-30T19:49:06Z
From: GrzeĊ›
Subject: logical vector as a matrix
In-Reply-To: <8d4c23b10905291854l2f3dc30fvfae1583b7b4a1550@mail.gmail.com>

Thanks a lot! :)

Linlin Yan wrote:
> 
> On Sat, May 30, 2009 at 2:48 AM, Grze? <gregorio99 at gmail.com> wrote:
>>
>> I have a vector like this:
>> h <- c(4, 6, NA, 12)
>> and I create the secound logical vector like this:
>> g <- c(TRUE, TRUE, FALSE, TRUE)
> Why don't you create vector g like this:
> g <- ! is.na(h)
> 
>>
>> And my problem is that I would like to get ?a new "m" vector as a rasult
>> "h"
>> and "m" but with missed "NA" value, for example:
>>
>> m = (4,6,12)
>> Do you have any idea?
> As what you tried to do:
> m <- h[g] # which got (4,6,12)
> you can directly use:
> m <- h[ ! is.na(h) ]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: http://www.nabble.com/logical-vector-as-a--matrix-tp23785253p23796761.html
Sent from the R help mailing list archive at Nabble.com.