Axis Labels in R: p(Y=y | theta = something) -
i've searched on , can't find code having conditional sign in
p(a|b)
the code (generic r code, not ggplot) i'm using
ylab = bquote(pr( y == y | theta == .(mytheta) , n == .(n)))
what gives me label
pr(|(y=y,theta=0.2), n=10)
where theta proper greek symbol, mytheta 0.2, , n 10. that's not working conditional sign. looks me r taking | or...
i haven't tried ggplot yet, working in plain r first.
thanks help.
i thought pretty interesting see 'pipe' (vs. 'or') parsed polish notation. conditional-bar can accessed symbol font using methods described in ?plotmath
, ?points
plot(1,1, main=bquote(pr( y == y ~ symbol("\275") ~ theta == .(mytheta) , n == .(n))))
(i did try making special user-defined function using %|%
missing conditional symbol, failed.)
to comment-question asking illustration (actually 2 versions of how use substitute
in equivalent manner:
mytheta = 0.2 plot(rnorm(100), rnorm(100), ylab= substitute(p(y~"|"~ mytheta ), list(mytheta=mytheta)) ) plot(rnorm(100), rnorm(100), ylab= substitute(p(y~"|"~ theta == mytheta ), list(mytheta=mytheta)) ) # second version prints greek-theta == value
Comments
Post a Comment