Skip to content
Prev 246086 / 398503 Next

access a column of a dataframe without qualifying the name of the column

On Dec 30, 2010, at 07:12 , <Bill.Venables at csiro.au> <Bill.Venables at csiro.au> wrote:

            
Now that's a rather interesting novel word you got there, Bill....
Yes, and similar stuff goes on in subset.data.frame(), with(), etc. However, there is a trend towards preferring to do non-standard evaluation in a more standard (less non-standard?) way, using formulas:
[1]  1  2  3  4  5  6  7  8  9 10
[1] 12 14 16 18 20 22 24 26 28 30

Or, you could pass expression(x) or quote(x) explicitly, but it's a bit more long-winded and you lose the ability to pass along the environment of the formula (and typically use enclos=parent.frame() instead).