[R] extract a value from vector

Paul Smith phhs80 at gmail.com
Tue Sep 12 20:11:01 CEST 2006


On 9/12/06, Ethan Johnsons <ethan.johnsons at gmail.com> wrote:
> A quick question, please!
>
> How do you extract a certain value of vector?
> i.e. x = c(2,5,3,6,21,3,6,24, ....)
>
> How do you get the 1st one (which is 2); the 5th one (which is 21); etc?

Simple, Ethan:

x[1], x[5], ...

Paul



More information about the R-help mailing list