[R] Using Unicode inside R's expression() command

Sverre Stausland stausland.johnsen at iln.uio.no
Sat Nov 9 20:01:27 CET 2013


I'm using 'expression()' in R plots in order to get italicized text.
But it appears as if I cannot use Unicode symbols inside 'expression'
outside of ASCII characters. Is there some way I can work around this?
My goal is to get the 'fi' ligature in various labels in my R barplots
(together with italicized text). I think I could work around this if
there was another way of italicizing selected characters in a string
than using 'expression()'.

I'm using R for Windows version 3.0.2.

    CairoPDF(file = "Ligature1.pdf")
    plot.new()
    text(x =.5, y = .5, labels = "fi", family = "Times New Roman")
    dev.off()

    CairoPDF(file = "Ligature2.pdf")
    plot.new()
    text(x =.5, y = .5, labels = expression(paste(italic(m), "u", "fi",
italic(m), sep = "")), family = "Times New Roman")
    dev.off()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lig1.png
Type: image/png
Size: 680 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20131109/5ed05b75/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lig2.png
Type: image/png
Size: 4409 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20131109/5ed05b75/attachment-0001.png>


More information about the R-help mailing list