So, this is a problem I’ve had before (read: on the regular), and happily work around, but that I thought might be helpful to others.
When I knit an R Markdown document and there are errors, the
Line number doesn’t match up with the line numbers in the document.
Double-clicking on the error message just brings you to the line number stated, so I usually end up searching for the text that shows up in the error message
I used to basically count lines within my code chunks, but ever since my discovery of
r emo::ji(), my use of inline code (and errors therein ) has kind of skyrocketed.
I have no idea what the internals look like for this, and, thus, have no understanding of technical feasibility, but I’m curious if there have been any ideas about how this might be done differently for R Markdown.
My first thought (or second, rather, the first would be not to make mistakes in my code) is just to do away with line numbers all together (I’ve spent more time trying to discover mistakes in a particular line of text than I should probably admit), but that seems like throwing the baby out with the bathwater.
Don’t think it’s relevant, but just in case, setup info:
- RStudio Version 1.1.383
- R version 3.4.2