[R] logical vector as a matrix

Jorge Ivan Velez
Sat, 30 May 2009 01:58:05 -0000

Dear Grzés,
Try

h[ !is.na(h) ]

# or

h[g]


HTH,

Jorge


On Fri, May 29, 2009 at 2:48 PM, Grze¶ <gregorio99@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)
>
> 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?
>
>
>
> --
> View this message in context:
> http://www.nabble.com/logical-vector-as-a--matrix-tp23785253p23785253.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]