library(cmu202)

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center",
  warning = FALSE,
  message = FALSE,
  echo = FALSE,
  fig.width = 7,
  height = 6
)

When working in an RMarkdown file, formatting can sometimes be tricky. Adding the asis tag within a code chunk ensures that anything in the code chunk will be displayed as text. For example, typing:

x <- 5

as text will be indistinguishable from

cat(htmltools::includeText("asis_example.txt"))

when knitted. Note that the x <- 5 is treated as text, not code. No variable named x will be created.

In short, asis ensures that anything in the chunk will be treated as text.



frank113/cmu202 documentation built on July 17, 2020, 9:31 p.m.