[R] R in ConTeXt

Paul Johnson pauljohn32 at gmail.com
Sat Jun 17 04:39:46 CEST 2006

I will test this out, but I'd like to point out that there is probably
an easier way.

Using LyX configured with Rweave, my students and I have had very good
luck generating documents that incorporate R graphics.  Like you
propose, it is a one-file approach.  I have example lyx and pdf output
files online in http://pj.freefaculty.org/stat/Distributions and there
is a guide to configure LyX so this works in a seemingly apparent way
on the LyX wiki:
http://wiki.lyx.org/LyX/LyxWithRThroughSweave.  We worked out a
Windows scheme to do the same, but I did not document it.


On 6/16/06, Johan Sandblom <jsandblom at gmail.com> wrote:
> In case there are users of the TeX macro package ConTeXt on this list,
> they may be interested to know that it is now possible to include R
> code in a ConTeXt document and have the code evaluated while
> compiling. The inverse of Sweave, as it were. The advantage is that
> there is then only one file to keep track of (.tex vs .rnw and .tex),
> while a drawback is speed, since each code snippet is evaluated in its
> own R session with associated startup time. Below is a small example
> of usage
> \usemodule[r]
> \starttext
> \title{Example usage of R module}
> \startRhidden
> rm(list=ls())
> x <- rnorm(100)
> y <- runif(100)
> \stopRhidden
> \type{x} and \type{y} are randomly generated.
> \startR
> summary(lm(y~x))
> pdf("xy.pdf")
> plot(y~x)
> dev.off()
> \stopR
> \placefigure{Y vs X}{\externalfigure[xy][width=.4\textwidth]}
> \stoptext
> Regards, Johan
> --
> Johan Sandblom  N8, MRC, Karolinska sjh
> t +46851776108  17176 Stockholm
> m +46735521477  Sweden
> "What is wanted is not the will to believe, but the
> will to find out, which is the exact opposite"
> - Bertrand Russell
> ______________________________________________
> 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

Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

More information about the R-help mailing list