[R] Special characters: plus/minus

Duncan Murdoch murdoch at stats.uwo.ca
Mon Mar 20 20:12:50 CET 2006


On 3/20/2006 10:24 AM, Smith, Phil wrote:
> Hi R people!
> 
> :-)
> 
> I am printing a table of percentages (P) and their 95% confidence
> interval half-widths (CI).
> 
> I would like to 
> 
> (i) create a character string of P and CI that has the plus/minus
> character to the left of CI, then
> 
> (ii) use write.csv to save that file with the P, CI and the special
> plus/minus character.
> 
> 
> 
> I poured over the r-help archives and did not find advice on this. That
> advice could be there, but I did not see it! 

The plus/minus character isn't basic ascii, so you might run into 
character encoding problems with this.  It is Unicode character U+00B1, 
which is available in R as \u00B1 on some platforms, or directly using 
the Character Map utility to get it into the clipboard in Windows.  But 
be prepared for problems when you print.

An alternative is to use the ascii sequence +/-.  That's what I'd do.

Duncan Murdoch




More information about the R-help mailing list