[R] Superscripts and rounding

Polwart Calum (County Durham and Darlington NHS Foundation Trust) calum.polwart at nhs.net
Tue Jul 28 20:03:42 CEST 2009


I'm anything but an expert in R however if I'm labeling a graph axis with a superscript I have tended to use:

> plot (x , y , xlab = expression ("label"^2))

But when you try to have more than one superscript it fails.  Assuming you are in a UTF8 location (Western Europe) you could try:

> plot (x , y , xlab = expression ("Some label text \UB2 some more label text \UB2"))

That works for me.  (B2 is the hex code for UTF-8 character = ^2 and \U is a control sequence that will call that character.)  It onlyu works if you are a UTF8 area from what i understand.

--

As for rounding - can you not populate a new field using the round command?

i.e. something like

[metadata][long_4dig] = round([metadata][longitude],4)  #I haven't used round before my syntax may be wrong!

Then use %s to drop that value in?

C

********************************************************************************************************************

This message may contain confidential information. If yo...{{dropped:21}}




More information about the R-help mailing list