[R] Selecting columns of a table (not consecutive)

Nolwenn LeMeur nlemeur at fhcrc.org
Mon Oct 3 00:29:56 CEST 2005


George Papayiannis wrote:

>Hi everyone,
>
>I have a table with 10 columns and many rows.
>I want to select the 3rd,4th and 10th column.
>
>If I wanted to select the 3rd and 4th it would be no
>problem.
>
>q3[ ,(3:4)]
>
>but how do I select the 10th along with it?
>
>Thanks for your help,
>George
>
>p.s Please respond if you know, assignment is due
>tomorrow...
>
>Thanks again..
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>  
>
Hi George,

Try
 subset(q3, select=c(3,4,10))

Nolwenn




More information about the R-help mailing list