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)))

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]]

______________________________________________
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.

Reply via email to