[R] Degree symbol

Duncan Murdoch murdoch.duncan at gmail.com
Tue Mar 29 21:22:10 CEST 2011


On 29/03/2011 3:11 PM, stephen's mailinglist account wrote:
> On 29 March 2011 19:48, Duncan Murdoch<murdoch.duncan at gmail.com>  wrote:
> >  On 29/03/2011 2:40 PM, stephen's mailinglist account wrote:
> >>
> >>  I have been using both Windows and Linux versions of R>>  Now I have found that the following expression seems to work on both systems
> >>
> >>  xlab = expression(paste("Temperature [",degree,"C]")),
> >>
> >>
> >>  Now my question is can I set up my Linux (ubuntu) system to recognise
> >>  the degree symbol input from the keyboard, or for the sake of
> >>  portability should I just go with the solution I have found?
> >
> >  The issue may be that your Linux system is using UTF-8 encodings, while your
> >  Windows one is using the Windows version of Latin1.  So if you tell R that
> >  your file is encoded in Latin1, it will likely work.  You can do this in the
> >  DESCRIPTION file for a package, or the "encoding" argument to source().
> >
> >  You can probably tell Ubuntu to use Latin1 for everything, but I would guess
> >  that's a bad idea.
> >
> >  Duncan Murdoch
> >
> Thank you
> I will experiment with source (looks to be source(file,
> encoding=getOption("latin1" or "UTF-8")).

No, getOption("encoding") is the literal default, not some sort of 
general form.  You want

encoding="latin1"

(assuming the whole file uses that encoding).

Duncan Murdoch
> Packaging is almost certainly a good idea to make my code more
> general, and re-usable by me and others.  So I need to continue in
> this direction
>
>



More information about the R-help mailing list