Hello,

I posted a similar question earlier, but without a response - maybe it wasn't worded properly, as I was in a bit of a panic, when it was posted.

SWeave and Lyx are a great combination for combining R code and R output into the same document and most of the time this is fine, but occasionally I need a 2nd version without the code, but still any graphs produced by the code.

I did try branches, but switching off a branch, which runs a calculation that a figure relies on, breaks the figure code.

I also tried putting the code in an appendix, but this has a similar problem with the figure code calling data that hasn't yet been created.

Has anyone any idea how this can be got around, and give me the two document versions: one with code and one without.

I could live with all the code ending up in an appendix, and wondered if there was some clever way of working with two files, one for the analysis that would run first, then the main document could grab output from this analysis file for the main text, and then dump the analysis file into the compiled document as an appendix. If that makes sense.

Any suggestions gratefully received.

Graham

Reply via email to