Knitr Compile Problems with Rstudio (Windows)

Error when compiling pdf using knitr in rstudio

Although I still do not understand why, but from the comments above, the problem seems to come from ~/.Rprofile (in particular, setwd()). Clearing it up solves the problem.

Note you may have other startup profile files. .Rprofile is only one possibility. See ?Startup for more information. For example, if you are on Windows, you may need to take a look at C:\Program Files\R\etc\Rprofile.site if it exists.

Knitr compiling and running all at the same time in RStudio

When you knit a document, the work happens in a different R session, which is why you can't examine the results in the current session.

But you have a lot of choices besides run all. Take a look at the Run button: it allows you to run chunks one at a time, or run all previous chunks, etc.

If some of your chunks take too long to run, then you should consider organizing your work differently. Put the long computations into their own script, and save the results of that script using save(). Run it once, then spend time editing the display of those results in multiple runs in the main .Rnw document.

Finally, if you really want to see variables at the end of a run of your vignette, you can add save.image(file = 'vignette.RData') at the end, and in your interactive session, use load('vignette.RData') to load the values for examination. This won't necessarily give you an accurate view of the state of things at the end of the run, because it will load the values in addition to anything you've already got in your workspace, it won't load option settings or attach packages, but it might be enough for debugging.

Error generating .pdf using knitr to PDF in RStudio

According to the comments, the answer posted at https://tex.stackexchange.com/a/27141 solved the issue.

The relevant part:

Remedy: start MiKTeX Options and choose either Yes or No (but not "Ask
me first") for the option "Install missing packages on-the-fly"



Related Topics



Leave a reply



Submit