[R] matrix subset

vincent@7d4.com vincent at 7d4.com
Sat Nov 12 21:27:17 CET 2005


Marc Schwartz a écrit :

> What version of R are you using?  You did not indicate this in your post
> as you are asked to do in the posting guide.

I apologize for that, I use Version 2.0.1

> In R version 2.1.0, a matrix method was added to the subset() function,
> so I am guessing that you are several versions out of date. Please
> upgrade to the latest version, which is 2.2.0, where you will get:
> 
>>subset(m, m[, 2] >= 5)
> 
>      [,1] [,2] [,3] [,4]
> [1,]    2    5    8   11
> [2,]    3    6    9   12

So, I will upgrade, thanks.

> Also, you do not need the semi-colons at the end of each line. They are
> only generally used if you wish to place more than one R statement on a
> single line.

I'm an old C programmer ... and it's an old (good) behavior.
Without semicolons at the end of lines I feel naked like a worm in the
desert. (I'll keep them).

Thanks for your kind help.

Vincent




More information about the R-help mailing list