both the following will probably do the trick.

?subset
?"["

Basically on the second one, you want to come down to something that
looks like

x[L]

where x is a matrix/vector, and L is a logical vector that has the
same dimension as x, but is TRUE on the values of x that you want to
select.

for instance

x <- rnorm(100000)
L <- x > 3
x[L] will return all values of x that are greater than 3.

or you can just do

x[x>3]



On Sep 25, 9:45 am, "Jim Bouldin" <jrboul...@ucdavis.edu> wrote:
> I realize this should be simple but I'm having trouble subsetting vectors
> and matrices, for example extracting all values meeting a certain
> criterion, from a vector. Cannot seem to figure out the correct syntax and
> help page not very helpful.  Or should I be using some other function than
> subset.  Thanks for any help.
>
> Jim Bouldin
>
> ______________________________________________
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
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.

Reply via email to