tests/testthat/examples/knitr-examples/113-externalization.md

Code Externalization

Write R code in external R scripts, and use read_chunk() to read them into the current document.

knitr::read_chunk("113-foo.R")

The following two chunks are from the external R script 113-foo.R:

1 + 1
## [1] 2
x = rnorm(10)
mean(x)
## [1] 0.07463
sd(x)
## [1] 0.9538


Try the parsermd package in your browser

Any scripts or data that you put into this service are public.

parsermd documentation built on Aug. 21, 2025, 5:27 p.m.