Skip to content

How to access a column by its label?

3 messages · Neil McLeod, vincent at 7d4.com, Marc Schwartz (via MN)

#
On Thu, 2006-08-03 at 14:44 -0400, Neil McLeod wrote:
You answered your own question...animals[,"weight"]

You can also do:

animals$weight

or

animals[["weight"]]

or 

subset(animals, select = weight)


See ?Extract and ?subset for more information.

HTH,

Marc Schwartz