[R] Hmisc latex() does not want to work

Richard M. Heiberger rmh at temple.edu
Mon Jan 14 02:12:40 CET 2008



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of John Kane
Sent: Sunday, January 13, 2008 03:56 PM

## Not run: 
latex(x)   # creates x.tex in working directory
w <- latex(x, file='/tmp/my.tex')
---------------------------------------------

I think there is an unclarity in the documentation.  The documentation
is correct and everything that Frank and Gabor wrote
is also correct.  The issue is side-effects, which I think need a bit more
explanation.  I would revise the first example above to read:


latex(x)   ## 1. creates x.tex in working directory and 
           ##
           ## 2. The result of the command is an object of class "latex"
           ##    which is automatically printed by the latex print method.
           ##    The latex print method prepends and appends latex headers
and
           ##    calls the latex program in the PATH.  If the latex program
is
           ##    not in the PATH, you will get error messages from the
operating
           ##    system.

Since you didn't have latex in the PATH, you got an error from the print
method.  The x.tex file was probably correctly generated and might still be
sitting
in your default getwd() directory.

The second example,
w <- latex(x, file='/tmp/my.tex')
doesn't give an error message because the result of the latex() command is
saved in the object w and not automatically printed.


Rich




More information about the R-help mailing list