Thursday, January 26, 2012

How to append R code in appendix using Sweave

In the statistics course I'm doing, the solutions to assignments have R code, but the instructor doesn't want to see them in the main text but rather in an appendix.  Here's apparently how to do that without copying and pasting the code into an appendix (I got this nifty example from here):

\section{Appendix A}
\subsection{R session information}


\subsection{The simulation's source code}



SourceCode <- readLines(file.path("Projectpath","Codefile.R"))



1 comment:

Term papers said...

Good Article About
"How to append R code in appendix using Sweave"