6

Is there a clean solution for numbering lines in code chunks in R Markdown?

There is some relevant information here, it solves this problem for .Rnw files, however I'm looking for a solution for .Rmd files (with HTML output). Preferably the solution would provide continuous numbering within the document, instead of starting over at each code chunk. This would allow for referencing an earlier code chunk via a line number.

I am also looking for a solution that doesn't require repeating the code chunk (like here) since that seems error prone (inevitably there will be cases where one chunk gets updated and the other isn't).

Community
  • 1
  • 1
mine
  • 133
  • 1
  • 5
  • I ended up going this route, using both html/pdf, but it's a bit more work: http://tex.stackexchange.com/questions/179926/pandoc-markdown-to-pdf-without-cutting-off-code-block-lines-that-are-too-long – blep Sep 11 '15 at 03:01
  • 1
    Awesome answer to this in a related question here: http://stackoverflow.com/a/37927810/1036500 – Ben Jun 23 '16 at 11:24
  • 1
    @Ben Thanks, Ben :) – Martin Schmelzer Jun 26 '16 at 22:01

0 Answers0