An example for purl()

The function purl() can be used to extract code chunks from a document.

1+1
strsplit('hello world', ' ')

A second chunk.

if (FALSE) plot(1:10)

When we do not evaluate a chunk, the code from purl() will be commented out.

paste(letters, collapse = '|')
if (1 == 1) {
  'Awesome!'
}

If one chunk should not be included in the results from purl(), just use the chunk option purl = FALSE:

# we do not like significance stars!
options(stringsAsFactors = FALSE, show.signif.stars = FALSE)

That is it.



Try the parsermd package in your browser

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

parsermd documentation built on May 20, 2021, 5:08 p.m.