[R] Printing/Generating/Outputting a Table (Not Latex)

Kate Ignatius kate.ignatius at gmail.com
Tue Dec 9 21:11:46 CET 2014


Ah yes, you're right.

The log has this error:

! LaTeX Error: Missing \begin{document}.

Though can't really find much online on how to resolve it.

On Tue, Dec 9, 2014 at 1:15 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
> pdflatex appears to have run, because it exited. You should look at the tex log file, the problem is more likely that the latex you sent out to pdflatex was incomplete.
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On December 9, 2014 8:43:02 AM PST, Kate Ignatius <kate.ignatius at gmail.com> wrote:
>>Thanks!  I do get several errors though when running on Linux.
>>
>>Running your code, I get this:
>>
>>Error in system(cmd, intern = TRUE, wait = TRUE) :
>>error in running command
>>
>>Fiddling around with the code and running this:
>>
>>tmp <- matrix(1:9,3,3)
>>tmp.tex <- latex(tmp, file='tmp.tex')
>>print.default(tmp.tex)
>>tmp.dvi <- dvi(tmp.tex)
>>tmp.dvi
>>tmp.tex
>>dvips(tmp.dvi)
>>dvips(tmp.tex)
>>library(tools)
>>texi2dvi(file='tmp.tex', pdf=TRUE, clean=TRUE)
>>
>>I get this:
>>
>>Error in texi2dvi(file="tmp.tex",,  :
>>  Running 'texi2dvi' on 'tmp.tex' failed.
>>Messages:
>>/usr/bin/texi2dvi: pdflatex exited with bad status, quitting.
>>
>>I've read that it may have something to do with the path of pdflatex.
>>
>>Sys.which('pdflatex')
>>
>>           pdflatex
>>
>>"/usr/bin/pdflatex"
>>
>>
>>Sys.which('texi2dvi')
>>
>>           texi2dvi
>>
>>"/usr/bin/texi2dvi"
>>
>>> file.exists(Sys.which('texi2dvi'))
>>
>>[1] TRUE
>>
>>> file.exists(Sys.which('pdflatex'))
>>
>>[1] TRUE
>>
>>Is there a specific path I should be giving with pdflatex and/or
>>'texi2dvi to make this work?
>>
>>Thanks!
>>
>>On Mon, Dec 8, 2014 at 11:13 PM, Richard M. Heiberger <rmh at temple.edu>
>>wrote:
>>> yes of course, and the answer is latex() in the Hmisc package.
>>> Why were you excluding it?
>>> Details follow
>>>
>>> Rich
>>>
>>>
>>> The current release of the Hmisc package has this capability on
>>> Macintosh and Linux.
>>> For Windows, you need the next release 3.14-7 which is available now
>>at github.
>>>
>>> ## windows needs these lines until the new Hmisc version is on CRAN
>>> install.packages("devtools")
>>> devtools::install_github("Hmisc", "harrelfe")
>>>
>>> ## All operating systems
>>> options(latexcmd='pdflatex')
>>> options(dviExtension='pdf')
>>>
>>> ## Macintosh
>>> options(xdvicmd='open')
>>>
>>> ## Windows, one of the following
>>>
>>options(xdvicmd='c:\\progra~1\\Adobe\\Reader~1.0\\Reader\\AcroRd32.exe')
>>> ## 32-bit windows
>>>
>>options(xdvicmd='c:\\progra~2\\Adobe\\Reader~1.0\\Reader\\AcroRd32.exe')
>>> ## 64 bit windows
>>>
>>> ## Linux
>>> ## I don't know the xdvicmd value
>>>
>>>
>>> ## this works on all R systems
>>> library(Hmisc)
>>> tmp <- matrix(1:9,3,3)
>>> tmp.dvi <- dvi(latex(tmp))
>>> print.default(tmp.dvi) ## prints filepath of the pdf file
>>> tmp.dvi  ## displays the pdf file on your screen
>>>
>>> On Mon, Dec 8, 2014 at 9:31 PM, Kate Ignatius
>><kate.ignatius at gmail.com> wrote:
>>>> Hi,
>>>>
>>>> I have a simple question.  I know there are plenty of packages out
>>>> there that can provide code to generate a table in latex.  But I was
>>>> wondering whether there was one out there where I can generate a
>>table
>>>> from my data (which ever way I please) then allow me to save it as a
>>>> pdf?
>>>>
>>>> Thanks
>>>>
>>>> K.
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>______________________________________________
>>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>>and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list