Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I generate reports in R without texi2dvi or TeX installed?

Tags:

r

I've been struggling for a week now trying to figure out how to generate reports in R using either Sweave or Brew. I should say right at the beginning that I have never used Tex before but I understand the logic of it.

I have read this document several times. However, I cannot even get a simple example to parse. Brew successfully converts a simple markup file (just a title and some text) to a .tex file (no error). But it never ever converts tex to a pdf.

> library(tools)
> library(brew)
> brew("population.brew", "population.tex")
> texi2dvi("population.tex", pdf = TRUE)

The last step always fails with:

  Error in texi2dvi("population.tex", pdf = TRUE) : 
  Running 'texi2dvi' on 'population.tex' failed.

What am I doing wrong?

The report I am trying to build is fairly simple. I have 157 different analysis to summarize. Each one has 4 plots, 1 table and a summary. I just want

output plot 1,2,3,4
output table
\pagebreak
...

that's it. Can anyone help me get further? I use osx, don't have Tex installed.

thanks

like image 498
Maiasaura Avatar asked May 13 '10 18:05

Maiasaura


5 Answers

You cannot run this without texi2dvi or TeX installed.

An alternative may be html output -- the hwriter package is useful for that.

That said, if you want to produce pdf out, Sweave is the way to go. Frank Harrell's site has a lot of useful info but all this requires a bit of familiarity with LaTeX so you may need to install and learn that first.

like image 184
Dirk Eddelbuettel Avatar answered Nov 04 '22 11:11

Dirk Eddelbuettel


If you are on OSX, might as well install the full tex live

http://mirror.ctan.org/systems/mac/mactex/MacTeX.mpkg.zip

It is a big download, but it will be nice to never have to install additional packages.

like image 45
stevejb Avatar answered Nov 04 '22 10:11

stevejb


Another solution: the ascii package in conjonction to your favorite markup language (asciidoc, txt2tags, restructuredtext, org or textile).

http://eusebe.github.com/ascii/

like image 3
eusebe Avatar answered Nov 04 '22 12:11

eusebe


It may be worthwhile spending a week or so just using LaTeX without R and going through a bunch of introductory LaTeX tutorials. Thus, when you start producing Sweave or Brew documents and you get errors, you will be better able to identify whether the error is arising from LaTeX or Sweave / Brew. A couple of Windows tools that make it easy to get started with LaTeX include MikTeX + TeXnicCenter or MikTeX + WinEdt.

like image 2
Jeromy Anglim Avatar answered Nov 04 '22 12:11

Jeromy Anglim


Another solution is to try a solution of connecting R to microsoft.

It is much weaker then Sweave, but for basic reporting might be what you need.

You might want to go through the example sessions given here: Exporting R output to MS-Word with R2wd (an example session)

like image 2
Tal Galili Avatar answered Nov 04 '22 10:11

Tal Galili