knitr - Is it possible to call external R script from R markdown (.Rmd) in RStudio? -



knitr - Is it possible to call external R script from R markdown (.Rmd) in RStudio? -

it's trivial load external r scripts per this r sweave example.

can same done r markdown?

yes.

put @ top of r markdown file:

```{r setup, echo=false} opts_chunk$set(echo = false, cache=false) read_chunk('../src/your_code.r') ```

delimit code next hints knitr (just @yihui in example):

## @knitr part1 plot(c(1,2,3),c(1,2,3)) ## @knitr part2 plot(c(1,2,3),c(1,2,3))

in r markdown file, can have snippets evaluated in-line:

title ===== foo bar baz... ```{r part1} ``` more foo... ```{r part2} ```

r knitr rstudio rmarkdown

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -