Thanks to Deepayan...again, for suggesting "parse". Here is how I added the degree symbol to a vector of text for my xyplot legend:
auto.key =list(points = FALSE,text=parse(text = paste(levels(as.factor(divertSST2$temp)), "*degree", sep = ""))), For me the tricky part was learning about adding the '*'. I found that in this suggestion: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/78961.html Michael Folkes -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: September 5, 2007 11:27 AM To: Folkes, Michael Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Lattice: key with expression function On 9/5/07, Folkes, Michael <[EMAIL PROTECTED]> wrote: > HI all, > I'm trying (unsuccessfully) to add the degree symbol to each line of > text in my legend (within xyplot). Here is the line of code, which > fails to interpret the expression > function: > > auto.key =list(points = > FALSE,text=paste(levels(as.factor(divertSST2$temp)),expression(degree) > ). > ..), > > I just get: > 7 degree > 8 degree > 9 degree That's because > paste("foo", expression(degree)) [1] "foo degree" > If I place 'expression' outside or just after the paste function it > also doesn't work. auto.key = list(text = expression(paste("foo", degree))) should work. I think the problem is that you want a vector of expressions, and that's a bit harder to get. I'm not sure what the best solution is, but if everything else fails, you could try using parse(text=) -Deepayan ______________________________________________ R-help@stat.math.ethz.ch 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.