Displaying 1 result from an estimated 1 matches for "tg_name1".
Did you mean:
tg_name2
2012 Jan 25
1
Converting strings into data frame column names
.... I have the following code:
phList<-c('ph2010','ph2009','ph2008','ph2007','ph2006') #Name of original
data frames
for (i in phList) {
x<-c(paste(i,"$ID",sep=""),paste(i,"$DATE_DISPENSED",sep=""),paste(i,"$TG_NAME1",sep=""),
paste(i,"$TG_NAME2",sep=""),paste(i,"$TG_NAME3",sep="")) # I may be over
complicating things here!?
phNew<-rbind(phNew,(data.frame(ID=get(x[1]), DATE_DISPENSED=get(x[2]),
TG_NAME1= get(x[3]), TG_NAME2=get(x[4]), TG_NAME3=get(x[5...