Re: [R] extract columns using their names

About this list Date view Thread view Subject view Author view Attachment view

From: Wolski (wolski@molgen.mpg.de)
Date: Fri 28 May 2004 - 00:28:51 EST


Message-id: <200405271628510279.01C80B99@mail.math.fu-berlin.de>


?subset

*********** REPLY SEPARATOR ***********

On 5/27/2004 at 5:19 PM Adrian Dusa wrote:

>Hello,
>
>Is there a way to extract multiple columns from a dataframe using their
>names instead of their numbers?
>
>Currently I use:
>
>data2 <- data1[, c(1,3,9)]
>
>And I am looking for something like
>
>data2 <- data1[, c("XX","YY","ZZ")]
>
>
>I use the same dataframe for many purposes, and I run codes that change
>the order of the columns every time.
>
>Many thanks,
>Adrian
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Adrian Dusa (adi@roda.ro)
>Romanian Social Data Archive (www.roda.ro)
>1, Schitu Magureanu Bd.
>050025 Bucharest sector 5
>Romania
>Tel./Fax: +40 (21) 312.66.18\
> +40 (21) 312.02.10/ int.101
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Dipl. bio-chem. Eryk Witold Wolski @ MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin 'v'
tel: 0049-30-83875219 / \
mail: wolski@molgen.mpg.de ---W-W---- http://www.molgen.mpg.de/~wolski

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:13 EST