Re: [R] access a column of a dataframe without qualifying the name of the column

2010-12-30 Thread peter dalgaard
g-winded and you lose the ability to pass along the environment of the formula (and typically use enclos=parent.frame() instead). > > > From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf > Of David Winsemius [dwinsem..

Re: [R] access a column of a dataframe without qualifying the name of the column

2010-12-30 Thread peter dalgaard
On Dec 30, 2010, at 01:44 , David Winsemius wrote: > > On Dec 29, 2010, at 7:11 PM, John Sorkin wrote: > >> I am trying to write a function that will access a column of a data frame >> without having to qualify the name of the data frame column as long as the >> name of the dataframe is passe

Re: [R] access a column of a dataframe without qualifying the name of the column

2010-12-29 Thread Bill.Venables
ius [dwinsem...@comcast.net] Sent: 30 December 2010 10:44 To: John Sorkin Cc: r-help@r-project.org Subject: Re: [R] access a column of a dataframe without qualifying the name of the column On Dec 29, 2010, at 7:11 PM, John Sorkin wrote: > I am trying to write a function that will access a co

Re: [R] access a column of a dataframe without qualifying the name of the column

2010-12-29 Thread John Sorkin
Thank you, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call

Re: [R] access a column of a dataframe without qualifying the name of the column

2010-12-29 Thread John Sorkin
Thank you John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call p

Re: [R] access a column of a dataframe without qualifying the name of the column

2010-12-29 Thread Bert Gunter
?substitute test <- function(col,frm) { eval(substitute(col),frm) } test2 <- function(col,frm){ cname<- deparse(substitute(col)) frm[[cname]] } z <- data.frame(x=1:3,y=letters[1:3]) test(x, z) test2(x, z) -- Bert On Wed, Dec 29, 2010 at 4:44 PM, David Winsemius wrote: > > On Dec 29,

Re: [R] access a column of a dataframe without qualifying the name of the column

2010-12-29 Thread David Winsemius
On Dec 29, 2010, at 7:11 PM, John Sorkin wrote: I am trying to write a function that will access a column of a data frame without having to qualify the name of the data frame column as long as the name of the dataframe is passed to the function. As can be seen from the code below, my funct

[R] access a column of a dataframe without qualifying the name of the column

2010-12-29 Thread John Sorkin
I am trying to write a function that will access a column of a data frame without having to qualify the name of the data frame column as long as the name of the dataframe is passed to the function. As can be seen from the code below, my function is not working: df <- data.frame(x=1:10,y=11:20)