1

I am writing a document in Sweave and would like to echo R code chunks in the final PDF with code lines. However, I cannot seem to find line numbers as a chunk option. Does anyone know how to include code lines in chunk echos?

For example, how can I get the following chunk to include the 2 line numbers (1 and 2) when the chunk is echo'd into the pdf?

<<echo = T, eval = T>>=
amount <- 5
5 * amount
@
  • If you're willing to switch from Sweave to knitr, you'll find an answer here: http://stackoverflow.com/questions/27593677/putting-line-number-for-r-code-with-knitr – Thomas Sep 21 '15 at 13:50

0 Answers0