[R] How to get a degree sign into a lattice factor level?

Sonam Lodro kagyukid at yahoo.com
Tue Nov 12 22:00:09 CET 2002


--- Martin Maechler <maechler at stat.math.ethz.ch> wrote:

> >>>>> "Sonam" == Sonam Lodro <kagyukid at yahoo.com>
> >>>>>     on Mon, 11 Nov 2002 17:04:57 -0800 (PST) writes:
> 
>     Sonam> I notice that expressions can be used in legends, but
>     Sonam> as far as I can tell, cannot be used as levels for
>     Sonam> factors.  I'd like to be able to do something like
>     Sonam> that so that the levels printed in a lattice plot
>     Sonam> show the degree character.
> 
>     Sonam> In Splus, I used to use element [203] (if I remember
>     Sonam> correctly) of a vector called All.ASCII which could
>     Sonam> be pasted with text to produce the effect I require.
> 
>     Sonam> What is a good way to achieve the same in R?
> 
> R uses iso-8859-1 (aka "iso-latin1") per default.
> Hence the following works ``automatically''
> 
>   > f4 <- gl(4, 3, labels = paste(10*(0:3),"°", sep=""))
>   > f4
>    [1] 0°  0°  0°  10° 10° 10° 20° 20° 20° 30° 30° 30°
>   Levels: 0° 10° 20° 30°
> 
> Now, how do you enter the `°' character ?
> I use Emacs and the sequence
> `C-x 8 * o' 

That's very simple.  Deepayan Sarkar's method of using expression (and 
which I asked about) is relatively complicated.  Since I use ESS, the 
simple way is best.  It's even easier than the All.ASCII method.

Thanks.


 
> (In Emacs, type  `` C-x 8 C-h ''  to get a list of all
>  ``international characters'' you can get with C-x 8 prefixes.
>  Locally we also use "A-" ("Alt" != Meta) key for entering
>  things like these; for us particularly the µäöü¢© .. are simple
>  Alt-key strokes)
> 
> The All.ASCII[] vector you found in S-plus actually comes from
> Statlib/S-news and was contributed by myself about 10 years ago.

Thanks also for that elucidation.

Layda

__________________________________________________

U2 on LAUNCH - Exclusive greatest hits videos

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list