David, thanks for the reply. No, I don't want to do it by hand because the actual data that I need to label is much larger and variable. The deltas occur in the label character vector for some labels and not others and are in different positions in the character strings.
In the example I gave, the 'y' is the argument in the function to the lapply where I was trying to iterate over the results from 'strsplit' to insert the 'Delta' - the results showed me it wasn't the way to go, but I was giving an example of what I'd tried. Cheers, eric On Thu, Jul 4, 2013 at 11:31 PM, David Winsemius <[email protected]>wrote: > > On Jul 4, 2013, at 8:14 PM, Eric Archer - NOAA Federal wrote: > > I have a character vector that I'm using to label ticks in a dotchart. >> Some >> of the elements in the vector have an asterisk (*) where a Greek Delta >> needs to be placed when the plot is generated. Here's a simple example: >> >> x <- 1:4 >> x.lab <- c("a*a", "bbb", "c*c", "ddd") >> dotchart(x, labels = x.lab) >> >> The first and third labels should be 'a<Delta>a' and 'c<Delta>c'. I've >> tried things like, >> >> x.lab <- strsplit(x.lab, "[*]") >> x.lab <- lapply(x.lab, function(y) expression(paste(y, sep = Delta))) >> > > The plotmath function paste has no sep argument. > > Do you want to do this "by hand"? (Since you have not offered values of > 'y'.) > > x.lab <- expression( a*Delta*a, bbb, c*Delta*c, ddd) > > # Note use of "*" and no quotes in an expression vector. > > x <- 1:4 > dotchart(x, labels = x.lab) > > -- > David. > > >> but because 'y' is unevaluated, the resulting list elements won't work as >> tick labels. I've tried to modify it by using bquote and substitute, but >> couldn't get anything closer. Any suggestions? Thanks! >> >> Cheers, >> eric >> >> -- >> >> Eric Archer, Ph.D. >> Southwest Fisheries Science Center >> NMFS, NOAA >> 8901 La Jolla Shores Drive >> La Jolla, CA 92037 USA >> 858-546-7121 (work) >> 858-546-7003 (FAX) >> >> Marine Mammal Genetics Group: swfsc.noaa.gov/prd-mmgenetics >> ETP Cetacean Assessment Program: swfsc.noaa.gov/prd-etp >> >> "The universe doesn't care what you believe. >> The wonderful thing about science is that it >> doesn't ask for your faith, it just asks >> for your eyes." - Randall Munroe >> >> "Lighthouses are more helpful than churches." >> - Benjamin Franklin >> >> "...but I'll take a GPS over either one." >> - John C. "Craig" George >> >> [[alternative HTML version deleted]] >> >> ______________________________**________________ >> [email protected] mailing list >> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> >> PLEASE do read the posting guide http://www.R-project.org/** >> posting-guide.html <http://www.R-project.org/posting-guide.html> >> and provide commented, minimal, self-contained, reproducible code. >> > > David Winsemius, MD > Alameda, CA, USA > > -- Eric Archer, Ph.D. Southwest Fisheries Science Center NMFS, NOAA 8901 La Jolla Shores Drive La Jolla, CA 92037 USA 858-546-7121 (work) 858-546-7003 (FAX) Marine Mammal Genetics Group: swfsc.noaa.gov/prd-mmgenetics ETP Cetacean Assessment Program: swfsc.noaa.gov/prd-etp "The universe doesn't care what you believe. The wonderful thing about science is that it doesn't ask for your faith, it just asks for your eyes." - Randall Munroe "Lighthouses are more helpful than churches." - Benjamin Franklin "...but I'll take a GPS over either one." - John C. "Craig" George [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.

