AW: [R] built-in Sweave-like documentation in R-2.x
deepayan at stat.wisc.edu
Mon Aug 9 17:43:34 CEST 2004
On Monday 09 August 2004 10:23, Khamenia, Valery wrote:
> > See the 'Writing R Extensions' manual, specifically
> > Creating R Packages -> Writing package vignettes
> thank you, i saw this entry. However, this entry is rather
> about how to include documents (in particular Sweave-based)
> into a package. But I have meant smth else.
> Let me explain in example. Today I use emacs as
> environment for my R-sessions. I am quite happy to
> use Sweave, but not happy, that there is no good
> possibility to run some selected *part* of the R-code.
> Indeed, the R-chunks are alternated with
> Latex-chunks in Sweave. So, if one would like to
> execute, say, three consequent R-chunks (C-c C-r in ESS-mode),
> then the corresponding Latex-chunks between the
> R-chunks will cause "side-effects". Actually, it is
> because neither ESS nor R could accept Latex-chunks
> and the markup symbols of Sweave. This makes interactive
> work in .Rnw files not fully convenient.
Is selecting and 'C-c C-r'-ing the 3 chunks separately that bad?
The pieces for what you want are there. You can use Stangle() on a
Sweave format file to extract the R code chunks. In your usage, a crude
implementation would involve writing your selection to a file, running
Stangle on it, and source()-ing the resulting .R file.
Others may have better suggestions.
More information about the R-help