Questions tagged [r-markdown]

R Flavored Markdown or "R Markdown" is a markdown variant used for content-creation and/or programming documentation interleaved with R code.

R Flavored Markdown, or simply "R Markdown", is a markdown variant used for content-creation and/or programming documentation in which text content is interleaved with R code. It is a modern example of literate programming and is frequently used in R vignettes and README files where an R Markdown file (usually with file extension .Rmd) is rendered as HTML via knitr pre-processing of embedded code chunks.

More details about R Markdown can be found in:

Two R packages currently implement R Markdown rendering:

Various script editors can display R Markdown documents with syntax highlighting and render the resulting markdown and HTML documents, including:

  • RStudio, a popular R IDE
  • Rcmdr, a graphical user interface available as an R package
10493 questions
44
votes
5 answers

RMarkdown: How to end tabbed content

Once I have defined tabs, how do I define content outside/below tabs? Or, how do I end tabbed content? I have planned a layout like so: title content above tabbed region. tab1 tab2 ------------------- tab content 1 ------------------- content below…
mindlessgreen
  • 11,059
  • 16
  • 68
  • 113
44
votes
4 answers

Create a loop that includes both a code chunk and text

I am trying to figure out how to create a loop that inserts some text into the rmarkdown file, and then produces the graph or table that corresponds to that header. The following is how I picture it working: for(i in 1:max(month)){ ### `r…
Isaac Fratti
  • 475
  • 1
  • 4
  • 8
44
votes
2 answers

including a interactive 3D figure with knitr

Using knitr it is possible to embed a rgl 3D graphics in a html document from a Rmarkdown source file: ```{r setup} library(rgl) knit_hooks$set(rgl = hook_rgl) x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x,y) ``` ```{r,…
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
42
votes
5 answers

Changing chunk background color in RMarkdown

I would like to have a certain code chunk highlighted in a different color (e.g. red) to indicate that it is bad practice. If I was using .Rnw, I could add the chunk option background = 'red' and get what I want, but this does not seem to work in…
AmeliaMN
  • 787
  • 1
  • 8
  • 9
42
votes
3 answers

Include HTML files in R Markdown file?

Quick Summary How do I place HTML files in place within an R Markdown file? Details I have created some nice animated choropleth maps via choroplethr. As the link demonstrates, the animated choropleths function via creating a set of PNG images,…
Mike Williamson
  • 4,915
  • 14
  • 67
  • 104
42
votes
2 answers

RMarkdown in Shiny Application

Problem Is there a way to insert (and evaluate) an RMarkdown script in a shiny application. (Note, I am not looking for a shiny application in RMarkdown that is explained here, nor am I looking for Markdown scripts in shiny (see Shiny Gallery…
David
  • 9,216
  • 4
  • 45
  • 78
41
votes
2 answers

How can i see output of .rmd in github?

I am practicing data analysis using R programming. I want my files to be on github. I am unable to figure out why github is not showing the output of .rmd files. Here is the link to the file in my github repository Data Analysis Practice I want the…
Shankar Pandala
  • 969
  • 2
  • 8
  • 28
41
votes
3 answers

Use internal links in RMarkdown HTML output

I am using R Studio to create a Rmarkdown (.Rmd) document. I tried: Jump to [Header 1](#anchor) I would like to set up a link so when a reader clicks it, they jump to a specific point on the page. Let's say the point I want them to be directed to…
Joe Parzival
  • 557
  • 2
  • 5
  • 10
41
votes
1 answer

How to include RMarkdown file in r package?

I'm in the process of creating a package in R and I also want to include an R Markdown file. This RMarkdown template contains functions from my package, and is rendered to an html document via knitr. The goal is to regularly run a function (via a…
Alex Franz
  • 461
  • 6
  • 8
41
votes
3 answers

R: How to make second level indented bullet points using RMarkdown ioslides?

How do I make second level bullets in RMarkdown from Rstudio? I tried * Level1 + leve2 and it didn't work. It's not exactly clear how to do it from the tutorial. This seems so simple to do in normal RMarkdown.
xiaodai
  • 14,889
  • 18
  • 76
  • 140
40
votes
2 answers

DiagrammeR mermaid: inconsistent results in rmarkdown ioslides

I have a rmarkdown presentation (ioslides) with 3 slides with flow diagrams worked in DiagrammeR's mermaid. The following file saved as .Rmd can reproduce the example (at least in my machine, hopefully yours too): --- title: "Untitled" author:…
PavoDive
  • 6,322
  • 2
  • 29
  • 55
39
votes
3 answers

Matplotlib in Rmarkdown/RStudio fails when calling LaTeX on `\$` with Anaconda

Problem description I am having to use Anaconda on Windows, and am trying to write an RMarkdown document, knitted into a pdf, where within the RMarkdown I am using some Python snippets. However, when I try make matplotlib use LaTeX (with the…
oliversm
  • 1,771
  • 4
  • 22
  • 44
39
votes
4 answers

How to add code folding to output chunks in rmarkdown html documents

I really appreciate the "code_folding" feature in RMarkdown. However, what I really need is to have the code show all the time and toggle the display on the output. --- title: "test file" author: "dayne" date: "June 10, 2016" output: …
dayne
  • 7,504
  • 6
  • 38
  • 56
39
votes
1 answer

How to skip error checking at Rmarkdown compiling?

I was writing an Rmarkdown document (compile to HTML) in RStudio, and there are some code chunks that deliberately generate errors. for example: ```{r} sum(a) ``` Since there is no previous definition for a this chunk will naturally generate an…
Benny
  • 847
  • 1
  • 10
  • 14
39
votes
1 answer

"Erroneous nesting of equation structures" in using "\begin{align}" in a multi-line equation in rmarkdown to knit+pandoc pdf

I am writing some multi-line equations in R Markdown - LaTeX, using auto-numbering and \begin{align}. Here's a working the example: --- title: "test" output: html_document --- (@eq01) $$ \begin{align} y = x^2 \\ y = x^3 \\ y =…
Hernando Casas
  • 2,837
  • 4
  • 21
  • 30