Fwd: R-beta: Printing

Thomas Lumley thomas at biostat.washington.edu
Fri Mar 13 18:11:26 CET 1998

>Date: Tue, 10 Mar 1998 16:58:35 +0100 (MET)
>From: Hubert Palme <palme at uni-wuppertal.de>
>To: r-help at stat.math.ethz.ch
>Subject: R-beta: Printing
>may be I'm stupid, but I don't understand the documentation concerning 
>1. How can I print a (nice) listing of any (non graphic) results?

There aren't really any facilities for pretty output of text results at
the moment. Most people probably cut and paste into LaTeX. Suggestions
have been made for getting output in LaTeX or HTML directly but I don't
think anything has been done.  Somewhere in the Statlib S archive there
are functions for printing tables directly to LaTeX files, which will
probably work with R.

>2. What is the difference between "print(object)" and "object" (the
>direct call)?
At the command line, essentially nothing.  However, you can use
print(object) in a function and it will work.  Also, the return
value of print('object') is probably not 'object'.

>3. Which commands are concerned by the "printcmd" option (resp. how
>can I print PostScript graphics directly)?

All the graphics functions draw on the "current device". This is usually
an X11 (or MS-Windows) window, but the commmand
sends future graphics output to the PostScript file. Also, in the Unix
version, print.plot() and save.plot("file.ps") copy the contents of
the x11 window in PostScript form to the printer or "file.ps"
respectively. The copying is not perfect in version 0.61, particularly
with the image() command, where white lines appear due to some rounding

If the plot on the screen is in color then the PostScript file produced by
save.plot() or print.plot() will be in color (unlike in S-PLUS), and so
will print in color or shades of gray (depending on your printer).

>Another question: Is there any simple way to assign value labels?

 Some of the functions of variable labels in eg SPSS are performed by
factor levels, so if you use
	x<-factor(x,labels=c("first level","second level","third level"))
the factor labels will usually appear in output. read.table() converts
non-numeric data to factors by default, which means that the data file can
contain labels instead of the data.

Thomas Lumley
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :

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