Re: [R] Converting strings into data frame column names

2012-01-24 Thread R. Michael Weylandt
Yes, I think you are overcomplicating: it's perfectly valid to subscript by names. (In fact, it's generally preferred to trying to use the $ for programming because it's so much more flexible) I.e., lapply( phList, function(df) get(df)[, c("ID", "DATE_DISPENSED", "TG_NAME1", "TG_NAME2", "TG_NAME3"

[R] Converting strings into data frame column names

2012-01-24 Thread dthomas
Hi all, I want to loop through a series of data frames and append them into one data frame, however I do not want all columns of the original data frames to be in the new data frame. I have the following code: phList<-c('ph2010','ph2009','ph2008','ph2007','ph2006') #Name of original data frames