[R] recommended way to group function calls in Sweave

Liviu Andronic landronimirc at gmail.com
Wed Apr 25 16:20:13 CEST 2012


On Wed, Apr 25, 2012 at 3:41 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> I would use the last method, or if the calls were truly repetitive (i.e.
> always identical, not just the same pattern), use a named chunk.
>
Labeled chunks are indeed what I was looking for [1]. As far as I
understand, this is what "Sweave functions" (or are these macros?)
look like:


<<>>=
d <- iris
ind <- 1:2
@

<<sw>>=
  summary(d[ , ind])
  cor(d[ , ind])
@

<<>>=
d <- iris
ind <- 2:4
<<sw>>
@


Regards
Liviu

[1] vignette('Sweave', 'utils')



More information about the R-help mailing list