Re: [R] how to use a column name from the data frame in the function

2013-08-22 Thread Steve Lianoglou
Hi, On Thu, Aug 22, 2013 at 9:49 PM, Jeff Newmiller 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 da

Re: [R] how to use a column name from the data frame in the function

2013-08-22 Thread Jeff Newmiller
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 ] } colname <- "a" myf(m,colname) Until you learn simple R syntax, I strongly recommend avoiding wri