[R] degree C symbol in a function

Gabor Grothendieck ggrothendieck at gmail.com
Wed Aug 25 05:10:16 CEST 2010


On Tue, Aug 24, 2010 at 10:45 PM, Daisy Englert Duursma
<daisy.duursma at gmail.com> wrote:
> Hello help,
>
> I have changed around some graphing code and made it into a function.
> Previously they y label of the axis was inserted as text in its own
> layout box.
>
> text(1,1, expression(~degree~C),cex=1)
>
> This worked great and resulted in the symbol for degree.
>
> In the function, I have changed it so:
>
> text(1,1,paste(b_unit),cex=1)
>
> and
>
> b_unit<-expression(~degree~C)
>
> This now inserts ~degree~C instead of the symbol.
>
>

Get rid of the paste:

plot(1)
text(1, 1, b_unit)

Actually, if you are going to specify these as formulas anyways you
can also get rid of "expression".and possibly the first ~ depending on
what you want:

plot(0, main = degree ~ C)

e <-  degree ~ C
plot(0, main = e)



More information about the R-help mailing list