2007-12-28

Using Sweave with LyX

It has been a while since I managed to configure LyX (a great "word processor") to work with Sweave (literate programming using LaTeX and R - wikipedia page). The paper describing the whole thing will probably be published in the next issue of Rnews. Since, I received some inquiries, I have created a temporary web page at Google with all the files needed for the configuration, ...

Happy LyX-ing with R!

3 comments:

Paul said...

I'm interested to see you are following up on my plan to use LyX with R. I noted a typo, where you list the files for download: ‘literature-scrap.inc’.

I wish we could use LyX like Emacs-Sweave, and send schunks to R one at a time, rather than processing the whole document.

I agree with your point that LyX doesn't spot R errors. The best approach I found was to label the schunks and then watch the terminal from which LyX was run. That would name the chunks where the errors occurred.

Paul Johnson

Ed Borasky said...

I'm just getting back to this Sweave/LyX integration myself. For some reason, the LyX examples on the main Sweave web site don't work any more. (They used to). When you try to export them, LyX is unhappy about the embedded "\Sexpr" commands.

This may be something in my configuration -- I have R in /usr/local rather than in /usr. But it's still annoying.

Paul said...

Hmmm. How is your LyX configured? Using "my way" or "his way"?

I don't think the R location should matter. But It would matter if
noweb.sty became unavailable.

I have a lot of example docs available in

http://pj.freefaculty.org/stat/Distributions.

Just today I ran the Wishart.lyx file and created a pdf, just uploaded to the Distributions directory. So I know "my way" still works.

Here's the line out of my .lyx/preferences

#
# CONVERTERS SECTION ##########################
#

#\converter "literate" "latex" "Rweave $$i" ""

\converter "literate" "latex" "R CMD Sweave $$i" ""

pj