eval_named_chunk | R Documentation |
Evaluate a named chunk from an Rmd file.
eval_named_chunk(rmd_file, label_name)
rmd_file |
Absolute path to rmd file |
label_name |
Name of label |
The value from the evaluated code chunk
temp_rmd <- tempfile(fileext = ".rmd")
text <- '
```{r not this label}
print("that is wrong")
```
```{r hello label}
text <- "hello, world"
print(text)
print(TRUE)
```
```{r another label}
warning("wrong label")
```
'
## Not run:
writeLines(text, con = temp_rmd)
eval_named_chunk(temp_rmd, "hello label")
# [1] "hello, world"
# [1] TRUE
file.remove(temp_rmd)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.