[R] confusion with R syntax
jim at bitwrit.com.au
Thu Oct 11 22:20:10 CEST 2007
Leeds, Mark (IED) wrote:
> I just noticed something by accident with R syntax that I'm sure is
> correct but I don't understand it. If I have
> a simple numeric vector x and I subscript it, it seems that I can then
> subscript a second time with TRUE
> or FALSE, sort of like a 2 dimensional array in C. Does someone know if
> this is documented somewhere
> Because it's neat but I never knew it existed. To me it seems like a 1
> dimensional vector should
> have only one dimensional indexing ?
> x <- seq(1,10)
>  1 2 3 4 5 6 7 8 9 10
>  2 4
> But, it only works for TRUE or FALSE and not numbers so I think it's not
> really 2 dimensional indexing.
>  NA
> If someone could explain this mechanism or tell me what I should look
> for in the archives, it would
> be appreciated. Thanks.
The first extraction is performed before the second.
More information about the R-help