On Feb 27, 2014, at 3:17 PM, Bert Gunter wrote: > ?plotmath > > -- Bert
Daryl;; I think what Bert was hoping you would do was read the plotmath page and figure it out on your own but that can be a bit tricky when working with expression object vectors. Here is (perhaps) a step forward: vectorA = c( bquote("TNF-"*alpha), bquote("IFN-"*gamma) ) for(ii in vectorA) { plot(0:1,0:1) title(main = ii) } Now as Jim Holtman is fond of saying... what problem were you (really) trying to solve? -- David. > > Bert Gunter > Genentech Nonclinical Biostatistics > (650) 467-7374 > > "Data is not information. Information is not knowledge. And knowledge > is certainly not wisdom." > H. Gilbert Welch > > > > > On Thu, Feb 27, 2014 at 2:58 PM, Daryl Morris <dar...@uw.edu> wrote: >> Hi, >> >> I have a function which generates many plots. To keep it simple, let's say >> I want to set the main title based on where we are in nested loops. >> >> So, something like >> >> vectorA = c("a","b","c") >> vectorB = c("a","b","c") >> >> for(ii in vectorA) { for(jj in vectorB) { >> plot(0:1,0:1) >> title(main = paste(ii,jj)) >> } >> >> that part is easy! The question is what if I wanted vectorA to be an >> expression? >> >> I'd like to be able to set vectorA = >> c(expression(paste("TNF-",alpha)),expression(paste("IFN-",gamma))), and have >> the plot title show the greek letters. >> >> Obviously, in the for-loop I could build the expression all at once, but >> there are lots of programmatic reasons I'd like to be able to have this >> program structure. Is there a solution which modifies either/both (1) the >> setting of main in the loop (2) how I define the vector outside of the loop? >> >> >> thanks, Daryl >> >> ______________________________________________ >> 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. > > ______________________________________________ > 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. David Winsemius Alameda, CA, USA ______________________________________________ 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.