
When R Markdown knits documents it explicitly configures the knitr cache to use. For examples of other other knitr options, see Customizing Chunk Options in R Markdown. title: Migrating from R Markdown v1 output: htmldocument: tocfloat. If the headers indicate that content should not be cached then it won’t be. The cache-ability of an item on the browser is determined by: The response headers returned from the origin web server. For more details, see the cache section of the knitr documentation. cache:true is the default and does not always get the content from the cache. This directory can be customized with the cache.path optoin. The cached results and output are stored in a cache/ directory relative to the current working directory.
#Rmarkdown cache code

This allows compute intensive chunks to be saved and the output used later without being rerun. To compile your document faster, specified code chunks can be cached. If you are a user of an R package that is generating HTML that includes indentation you can temporarily workaround the problem by rendering your documnent with rmarkdown v1 (see section below on Continuing to Use v1).Cache Code Chunks with knitr Cache Code Chunks with knitr One other important change relates to the use of the knitr cache.When R Markdown knits documents it explicitly configures the knitr cache to use a directory based on the name of the input file (e.g. Generate HTML that does not indent tags at the beginning of lines.Ī varation of #2, use the htmltools package to generate HTML (which will print its output by default without indentation). This will render as HTML not preformatted text

Cached code chunks store their results in a cache database in the subfolder.

Enclose the HTML in a special comment that indicates that no markdown processing should occur: Any output from R is included as you usually would using R Markdown.If you are creating an R function that generates HTML there are a number of ways to avoid this behavior: This means that if you indent generated HTML tags 4 spaces they will be output as preformatted (i.e. within a tag). The markdown processor considers any text that is indented 4 spaces to be preformatted text. The change to render markdown within HTML tags has consequences for R functions that generate HTML for inclusion in a markdown document.
