Re: Fwd: R-beta: Printing

Thomas Lumley (thomas@biostat.washington.edu)
Fri, 13 Mar 1998 09:11:26 -0800 (PST)


Date: Fri, 13 Mar 1998 09:11:26 -0800 (PST)
From: Thomas Lumley <thomas@biostat.washington.edu>
To: Hubert Palme <palme@uni-wuppertal.de>
Subject: Re: Fwd: R-beta: Printing
In-Reply-To: <199803131307.OAA02203@wrin27.urz.uni-wuppertal.de>

>Date: Tue, 10 Mar 1998 16:58:35 +0100 (MET)
>From: Hubert Palme <palme@uni-wuppertal.de>
>To: r-help@stat.math.ethz.ch
>Subject: R-beta: Printing
>
>
>may be I'm stupid, but I don't understand the documentation concerning 
>printing.
>
>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
	postscript("file.ps")  
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
problem.

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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._