tags:

views:

307

answers:

5

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

+1  A: 

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.

Dirk Eddelbuettel
I was so excited by this incredibly low-hanging fruit - I should have known you'd get here first. :/
Matt Parker
If html is good enough, hwriter hands _very low_: give it a data.frame and you're done. You can pretty-fy it, but you do not have to.
Dirk Eddelbuettel
When speaking of Frank Harrell... here's a good link that should suffice: http://gettinggeneticsdone.blogspot.com/2010/05/using-r-latex-and-sweave-for.html
aL3xa
+1  A: 

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.

stevejb
A: 

Hi Maiasaura,

Another solution is to try a solution of connecting R to micro$oft.

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)

Tal Galili
A: 

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.

Jeromy Anglim
A: 

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

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

eusebe