Mikkel Grum <[EMAIL PROTECTED]> writes: Hi Mikkel,
One way would be to use cat("\\section{", diseaseName, "}\n") with if (sum(matrixz) > 0) within a for loop (or perhaps using one of the apply family of functions (probably lapply?)). To some extent this by-passes the separation of code and documentation that literal programming is about but I couldn't think of a better way to solve the problem just now. Sorry this is not a full worked example, but I'm off to the pub now for a few pints to welcome 2005. Dave > 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 > > ______________________________________________ > R-help@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 > -- David Whiting University of Newcastle upon Tyne, UK ______________________________________________ R-help@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