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..
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
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
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
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
?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,
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
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)
8 matches
Mail list logo