Re: [R] logical vector as a matrix

2009-05-31 Thread Grześ
Thanks Jorge Ivan Velez! -- View this message in context: http://www.nabble.com/logical-vector-as-a--matrix-tp23785253p23796796.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mai

Re: [R] logical vector as a matrix

2009-05-31 Thread Grześ
Thanks a lot! :) Grześ 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 "g"( as dot-matrix printer) but wit

Re: [R] logical vector as a matrix

2009-05-31 Thread Grześ
Thanks a lot! :) Linlin Yan wrote: > > On Sat, May 30, 2009 at 2:48 AM, Grześ 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) >

Re: [R] logical vector as a matrix

2009-05-29 Thread Jorge Ivan Velez
Dear Grzés, Try h[ !is.na(h) ] # or h[g] HTH, Jorge On Fri, May 29, 2009 at 2:48 PM, Grze¶ 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

Re: [R] logical vector as a matrix

2009-05-29 Thread Linlin Yan
On Sat, May 30, 2009 at 2:48 AM, Grześ 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

[R] logical vector as a matrix

2009-05-29 Thread Grześ
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?