Hi,

On Thu, Aug 22, 2013 at 9:49 PM, Jeff Newmiller
<jdnew...@dcn.davis.ca.us> wrote:
> Please don't post in HTML format... it messes with code examples.
>
> Use character indexing (please read the Introduction to R... again if 
> necessary).
>
> myf <- function(df, colname){
>   df[ ,colname ]
> }

Or df[[colname]] for data.frames

> colname  <- "a"
> myf(m,colname)
>
> Until you learn simple R syntax, I strongly recommend avoiding writing tricky 
> code that plays with names of variables.

And even after you learn simple R syntax, if you think the right thing
to do is to use some combo of substitute/eval/quote and friends, I'd
strongly encourage you to think again ...

-steve

-- 
Steve Lianoglou
Computational Biologist
Bioinformatics and Computational Biology
Genentech

______________________________________________
R-help@r-project.org 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.

Reply via email to