includeText, includeHTML, and includeMarkdown

This file is include.txt. The content of this file is escaped, so special characters like & and <br> will display correctly in the web page. However, no other processing is done, so hard breaks and multiple spaces will be rendered as usual in HTML. If you want to display preformatted text, wrap the text in pre().
This file is include.txt.

The content of this file is escaped, so special characters like & and <br> will display correctly in the web page. However, no other processing is done, so hard breaks and multiple spaces will be rendered as usual in HTML.

If you want to display preformatted text, wrap the text in pre().

This file is include.html.

The content of this file is included as-is in the web page.

This is a div with a light red background.

This file is include.md

The content of this file is:

  • Processed with the markdown package, which transforms it into HTML.
  • The output is included in the web page.

Including code

In the .md file, R code is highlighted, and code can be included inline with backticks, as in sum(1:10). However, this is not an .Rmd file, and the code will not be executed by knitr.

# Some example code
x <- 12
x + 1
show with app
function(input, output) {

}
library(markdown)

fluidPage(

  titlePanel("includeText, includeHTML, and includeMarkdown"),

  fluidRow(
    column(4,
      includeText("include.txt"),
      br(),
      pre(includeText("include.txt"))
    ),
    column(4,
      includeHTML("include.html")
    ),
    column(4,
      includeMarkdown("include.md")
    )
  )
)