I have an RMarkdown document with some R code in it. The code works fine when I\'m running it interactively in the console. However, when I try to knit the document (using t
When you compile a document (using the "knit" button in RStudio), knitting takes place in a separate R session. Therefore, your document must be self-contained:
Also note that while knitting, your working directory is changed to the directory containing your document (by default). Therefore, relative paths (for example, paths to data sets you want to read) might not point to the expected files.