[R] Supressing empty sections with Sweave
Mikkel Grum
mi2kelgrum at yahoo.com
Sat Jan 1 09:56:06 CET 2005
Frank Harrel proposed the following solution:
\ifnum\Sexpr{x}=1
\section{}
. . .
\fi
and it works. Amazingly simple!
cheers,
Mikkel
--- Frank E Harrell Jr <f.harrell at vanderbilt.edu>
wrote:
> Mikkel Grum wrote:
> > Dear useRs,
> >
> > I'm writing regular survey reports using Sweave.
> Each
> > report has several sections along the lines of:
> >
> > \section*{Disease X}
> >
> > <<MapX,fig=TRUE,echo=FALSE>>=
> > image(vectorx,vectory,matrixz)
> >
> > @
> >
> > Notes with or without Sexpr{a}.
> >
> > \vfill
> >
> > \pagebreak
> >
> > \section*{Disease Y}
> > <<MapY,fig=TRUE,echo=FALSE>>=
> > ...etc.
> >
> >
> > Often one or more of the diseases is not observed
> (all
> > values in matrixz are 0), in which case I would
> prefer
> > not to display the section at all. Does any one
> no
> > whether it is possible automate this with Sweave?
> >
> > Mikkel
More information about the R-help
mailing list