Hi,
Well, simply :
d[a<24,2]
should do the trick.
Pierrick Bruneau
CRP Gabriel Lippmann
On Wed, Mar 20, 2013 at 12:53 PM, Andras Farkas <motyocska@yahoo.com>
wrote:
> Dear All,
>
> any thoughts on how I can do the following:
>
> let us say we have:
>
> a <-c(2,4,16,28,48)
> b <-c(10,4,2,0.4,0.03)
> d <-cbind(a,b)
>
> what I would like to do is to extract values of column b in the matrix
> based on the corresponding values of column a. For example: I would like to
> extract all b values that have a corresponding a value that is less than 24
> into a numeric vector, so let us say we name this new vector f, then the
> results should look like:
>
> f <-c(10,4,2)
>
> as allways your help is greatly appreciated,
>
> Andras
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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]]