Pergunta

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?

Foi útil?

Solução

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}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top