Try this data <- eval(parse(text=paste(study, level, ".", population, sep="")))
Jean ----- dbateman wrote on 08/31/2011 17:44:44: I have several datasets that come from different studies (fv02 and fv03), they represent different levels (patients and lesions), and they have different patient populations (itt, mitt, mitt3). I wanted to write some code that would pass my three requirements into a function I wrote, produce the output, but not have to require me to also pass a unique plot title or output filename for each function call. The title and file name would be created in the function according to the three input parameters. My datasets are named like this (all six are repeated for "fv03" in place of "fv02"): fv02patients.itt fv02patients.mitt fv02patients.mitt3 fv02lesions.itt fv02lesions.mitt fv02lesions.mitt3 Taking the first dataset as an example, I currently have this code: study="fv02" level="patients" population="itt" noquote(paste(study,level,".",population,sep="")) This produces the desired fv02patients.itt, but it is just an unquoted character string rather than a data frame. Here is a condensed look at my function: waterfall=function(data,title,file) { barplot(height=data$brpercent,main=paste("Best Change in Tumor Volume\n",title)), savePlot(filename=file,type="pdf") } waterfall(data=fv02patients.itt,title="EC-FV-02 ITT Patients",file=fv02_itt_patients_waterfall") It may be easier to leave it the way I have it, but if this is possible, I would still be interested in knowing. [[alternative HTML version deleted]] ______________________________________________ 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.