How can I add an en dash to a plot in R?
character, r
Solution
You're using Linux, so depending on how well R understands unicode, you could map one of your spare keyboard keys to the Compose Key and then just type it out. To get a —, press Compose and then the normal - key two or three times (depending on your system's mappings). Note that when using the Compose key, you don't hold it down - just press the keys in sequence.
Exactly how you'd enable that varies, but in Ubuntu, System->Preferences->Keyboard, Layout tab, Layout Options button, and select something appropriate for the "Compose key position" item. I usually use the Menu key.
Edit: My mistake, you wanted an en-dash, not an em-dash. Then en-dash (–) is Compose dash dash period, rather than Compose dash dash dash.
Problem
I'm creating a plot in R, and need to add an en dash to some axis labels, as opposed to your everyday hyphen. ``` axis(1, at=c(0:2), labels=c("0-10","11-30","31-70")) ``` I'm running R version 2.8.1 on Linux.