1

I'm using Sweave to make a report in R-Studio, and I have the problem, that my teacher will only accept reports, where the code is placed in an Appendix. This means that I need to control the position of the chunk outputs (graphs).

Is this possible in Sweave?

Regards,

Jens

1233023
  • 311
  • 7
  • 19
  • Can you provide [a minimal reproducible exmaple](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and show your intended output? This should be possible by referencing chunks and controlling output, but it's hard to say exactly without more information. – Thomas Jul 01 '15 at 11:59
  • Maybe this could help? [Appendix at the end](http://stackoverflow.com/questions/4362747/print-the-sourced-r-file-to-an-appendix-using-sweave) – M. Beausoleil Nov 22 '15 at 06:55

1 Answers1

0

This will return everything in your code. Using the \usepackage{fancyvrb} and the \VerbatimInput{test.Rnw} assuming that your file is named test.Rnw

\documentclass{article}
\usepackage{fancyvrb}

\begin{document}
\SweaveOpts{concordance=TRUE}

<<my_code_chunk>>=
2+2
@

\section{Appendix}
\VerbatimInput{test.Rnw}

\end{document}

Here is another example

\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}
<<my_code_chunk>>=
2+2
@
\section{Appendix}

<<>>=
<<my_code_chunk>>
@

\end{document}
M. Beausoleil
  • 3,141
  • 6
  • 29
  • 61