[R] using latex() in R for Unix

Don MacQueen macq at llnl.gov
Wed Apr 5 23:32:44 CEST 2006


Your command
     latex(Estimates, file='out.tex', rowlabel='',digits=3)
works for me in a unix environment, and produces 
the file out.tex in the current working directory.
(your second example is not reproducible, in 
general, since I don't have directory named
     /home/b/bquinif/bq/9095
)

Your first message indicated that the command
     latex(Estimates, file='out.tex', rowlabel='',digits=3)
did *not* return an error, just that you could 
not find the file. If that's the case, then try
   getwd()
to find out what R thinks your current directory 
is. That is where R should be putting the file.

You can also try, from within R,

    list.files()
    list.files(patt='tex')

to see what is there.

-Don

At 4:47 PM -0400 4/5/06, Brian Quinif wrote:
>Yes, Peter, I do mean the later() function from the Hmsic package.
>Below is a reproducible example.  Also, does anyone know how to stop R
>from automatically running LaTeX on the file produced by latex()
>
>library(Matching)
>library(Hmisc)
>
>#make up some data
>X <- matrix(rnorm(1000*5), ncol=5)
>Y1 <- as.vector(rnorm(1000))
>Tr <- c(rep(1,500),rep(0,500))
>
>#estimate nearest neighbor, 1-1 matching, ATT
>a <- Match(Y=Y1, X=X, Tr=Tr, M=1)
>summary(a)
>
>#make up some more data
>Y2 <- as.vector(rnorm(1000))
>
>#estimate nearest neighbor, 1-1 matching, ATT
>b <- Match(Y=Y2, X=X, Tr=Tr, M=1)
>summary(b)
>
>#Generate table of estimates
>Estimates <- matrix(c(a$est, b$est, a$se, b$se),nrow=2)
>rownames(Estimates) = c("a","b")
>colnames(Estimates) = c("Estimate","Standard Error")
>print(Estimates)
>
>#I use the next line of code for running in Windows--it works, and I
>can find the file out.tex
>#latex(Estimates, file='out.tex', rowlabel='',digits=3)
>
>#I use the next line of code for running in Unix--I get an error
>message saying the file/directory does not exist
>#latex(Estimates, 
>file='/home/b/bquinif/bq/9095/out.tex', 
>rowlabel='',digits=3)
>
>
>05 Apr 2006 22:29:54 +0200, Peter Dalgaard <p.dalgaard at biostat.ku.dk>:
>>  "Brian Quinif" <bquinif at gmail.com> writes:
>>
>>  > I am using R for Unix and want to make some LaTeX tables.  I have
>>  > already played around in R for Windows and have succeeded in making
>>  > tables that I want using the following code:
>>  >
>  > > latex(Estimates, file='out.tex', rowlabel='',digits=3)
>>  >
>>  > However, when I use this code in Unix, I can never find the file
>  > > "out.tex".  I assumed that R would send the file to whatever directory
>>  > I was working in, but that does not seem to be the case.  So, I tried
>>  > specifiying the exact location where I want the file:
>>  >
>  > > latex(Estimates, 
>file='/home/b/bquinif/bq/9095/out.tex', 
>rowlabel='',digits=3)
>>  >
>>  > When I do that, I get an error message sayin that the file/directory
>>  > does not exist.  I have written lots of files from Stata to locations
>>  > specified like above, so I don't understand what's going on.
>>  >
>>  > Can anyone help me straighten this out?
>>
>>  I assume you mean latex() from the Hmisc package? You might want to
>>  ask its maintainer. I can't reproduce your problem though; I get the
>>  file nicely in the current directory. (I got slightly bugged by
>>  Frank's idea of having the print method run latex on the file and fire
>>  up a viewer - didn't play well with a terminal login. However, that's
>>  completely unrelated).
>>
>>  Can you give a completely reproducible example that others might try?
>>
>>  --
>>    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
>>   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
>>   (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
>>  ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907
>>
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA




More information about the R-help mailing list