Frage

I am editing a .rnw file in R Studio. This is a project summary. For the project, I used both R code and bash script.

For the R code, I am using the typical syntax to actually execute the code in the file, as such:

<<>>=
Code in between these symbols executes
@ 

However, for the bash scripts, I do not want them to actually execute, but I want to include them in the same .rnw file so that a reader can view them and copy/paste them etc. Is there such a syntax to make non-executable code look like code separated from the text, while not actually running it?

War es hilfreich?

Lösung

I suppose you are looking for eval = FALSE:

<<eval=FALSE>>=
some code here
@

However, you could always just use the "verbatim" environment, which would be more appropriate for non-R code.

\begin{verbatim}
some code here
\end{verbatim}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top