[R] Including a tilde in a plotmath-type call

p_connolly at slingshot.co.nz p_connolly at slingshot.co.nz
Fri May 30 05:02:40 CEST 2008


Suppose I have a plot
plot(1:10, pch = "")

And I want some text to indicate a Normal distrubition.  I could do
this:

text(5, 6, substitute(X~~~~N(mu, sigma^2)), adj = 0)
text(5.35, 6, "~", adj = 0)

But that's clumsy, and depending on your plotting device, might not even look
sensible.  I'd prefer to be able to do it more directly and
simply the way these do:

text(5, 1, expression(X %~~% N(mu, sigma^2)), adj = 0)
text(5, 2, expression(X %prop% N(mu, sigma^2)), adj = 0)
text(5, 3, expression(X %=~% N(mu, sigma^2)), adj = 0)

They're easy, but they don't give a single tilde.  I know how to put a
tilde(X) or even a wide tilde, but there're not it either.

What did I miss?


--



More information about the R-help mailing list