[R] How to access a column by its label?

From: Neil McLeod <neil.a.mcleod_at_gmail.com>
Date: Fri 04 Aug 2006 - 04:44:49 EST


Hi all,

Is there any way to access a column of a data frame by its label (title) rather than its column index? For example, I'd like to be able to select animals[,"weight"] rather than animals[,3], if the third column of the "animals" data frame has the label "weight".

Thank you!

        [[alternative HTML version deleted]]



R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Fri Aug 04 04:52:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 04 Aug 2006 - 08:17:35 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.