Is there a way to knitr markdown straight out of your workspace using RStudio?

RStudio opens a new R session to knit() your R Markdown file, so the objects in your current working space will not be available to that session (they are two separate sessions). Two solutions:

  1. file a feature request to RStudio, asking them to support knitting in the current R session instead of forcibly starting a new session;
  2. knit manually by yourself: library(knitr); knit('your_file.Rmd') (or knit2html() if you want HTML output in one step, or rmarkdown::render() if you are using R Markdown v2)

Might be easier to save you data from your other session using:

save.image("C:/Users/Desktop/example_candelete.RData")

and then load it into your MD file:

load("C:/Users/Desktop/example_candelete.RData")

Tags:

R

Rstudio

Knitr