[R] format backslash behaviour

John Peters John.Peters at tip.csiro.au
Mon May 10 07:28:49 CEST 1999

The following seems weird:

> format("\pm2")
[1] "pm2"

> format("\\pm2")
[1] "\\\\pm2"

i.e. it seems impossible to set up a x so that "format(x)" returns 
"\\pm2", and in turn "cat(format(x))" prints "\pm2".  ("\pm" is latex for 

R is version 0.64 for win95.

I want to add a row of headings to a matrix of character objects, then 
use "format" on each column to make the matrix less ragged (not 
essential), and cat the result for use as a latex table.

Splus 3.4 does the same, and I currently regard compatibility with Splus 
as a very convenient feature, so I suppose it is not a bug.

I would appreciate any explanations for the behaviour, and any hints 
about neat workarounds.

Thanks, and thanks for R


John Peters
CSIRO National Measurement Laboratory
PO Box 218                                Phone:    +61 2 9413 7503
Lindfield NSW 2070                        Fax:      +61 2 9413 7202
Australia                                 Internet: John.Peters at tip.CSIRO.AU
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