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

前端 未结 4 488
暖寄归人
暖寄归人 2020-12-13 20:13

I wonder whether I can use knitr markdown to just create a report on the fly with objects stemming from my current workspace. Reproducibility is not the issue h

4条回答
  •  情话喂你
    2020-12-13 20:42

    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)

提交回复
热议问题