Skip to content

Instantly share code, notes, and snippets.

@kohske
Created May 16, 2018 23:57
Show Gist options
  • Save kohske/878b2475067d62f6846bb5300e30e551 to your computer and use it in GitHub Desktop.
Save kohske/878b2475067d62f6846bb5300e30e551 to your computer and use it in GitHub Desktop.
rmarkdown child
---
title: "ch01"
output: html_document
---
```{r}
library(ggplot2)
a = 1
b = 2
a
```
`r {e=new.env(parent=parent.frame());e$a=a;knitr::knit_child("ch02.Rmd", envir = e)}`
```{r}
a
```
---
title: "ch02"
output: html_document
---
親から引き継がれた変数とサーチパス
```{r}
ls()
search() # ggplot2が入ってしまっている。
```
```{r}
a
a=3
a
```
hoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment