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
4
votes
1 answer

kableExtra error in Markdown when rendering to PDF?

It seems that I am having trouble using kableExtra when trying to create a PDF by rendering an Rmd-file from an R Script. I have had no success in trying to follow the instructions at: R markdown compile…
rjen
  • 1,938
  • 1
  • 7
  • 19
4
votes
2 answers

How can I modify yaml instructions outside of the document I am rendering

I'd like to rmarkdown::render a R document without indicating the yaml options within the document itself. Ideally that could be an argument on rmarkdown::render or knitr::spin like what you can do to pass params (see the Rmarkdown reference book).…
statquant
  • 13,672
  • 21
  • 91
  • 162
4
votes
2 answers

Can I avoid evaluating inline Rmarkdown `r code` chunks?

In a vignette demonstrating how to use a Suggested package, I have something like this: if (suggested_package_not_available) { knitr::opts_chunk$set(eval = FALSE) } This means that the vignette still runs etc. although the Suggested package is…
mikldk
  • 194
  • 1
  • 4
4
votes
2 answers

RMarkdown. How to reduce space between title block and start of body text

I've been using RMarkdown via RStudio on a Mac successfully. Recently upgraded to RStudio 1.2.5019 and tinytex_0.18 and now the vertical spaceing between my "title block" and "first body text / heading" has increased. Simple example, (deliberately…
paulr
  • 55
  • 1
  • 1
  • 5
4
votes
1 answer

RMarkdown: Auto Number Equations

How can I autonumber equations in an Rmarkdown document? I've tried including "\usepackage{mathajax}" in the header, but the equations won't autonumber. I believe I need to configure mathjax, but can't figure out how. I'm open to any solutions.…
shredGnar
  • 149
  • 2
  • 11
4
votes
1 answer

LaTeX Error: Environment ThreePartTable undefined

I am trying to create a table using apa_table(), Papaja, and RMarkdown in RStudio. Whenever I include longtable in the apa_table function, I get the error: ! LaTeX Error: Environment ThreePartTable undefined. Strangely, the error log that's produced…
Tim Bainbridge
  • 177
  • 2
  • 9
4
votes
1 answer

Suppress line breaks created by RMarkdown

I am using a Rmarkdown (.Rmd) document to generate a markdown (.md) document for use with a Jekyll blog. I use knitr to create the .md file from the .Rmd file and there are additional line breaks in the .md file that were not in the original .Rmd…
Jesse Cambon
  • 355
  • 1
  • 2
  • 11
4
votes
1 answer

Have different .RMD file and output file names

I'm having troubles name my output PDF file from my "Knit with Parameters" RMD file. my YAML header looks something like this: --- title: "Discounting" output: pdf_document #with more parameters for later --- My file is called "Discounting…
morg
  • 381
  • 2
  • 17
4
votes
1 answer

Why does ggplotly does not work in rmarkdown the same way ggplot does

I would like to use ggplotly for it's side effect the same way ggplot does or even graphics does. By this I mean when I knitr::knit or rmarkdown::render a Rmd document I expect print(obj) where obj is a ggplotly objcet to be in the report and that's…
statquant
  • 13,672
  • 21
  • 91
  • 162
4
votes
1 answer

Rmarkdown cannot knit to pdf, work or html

When I tried to knit Rmarkdown file to a work file, I got an error like this: sh: /usr/local/bin/pandoc: Bad CPU type in executable Error in strsplit(info, "\n")[1] : subscript out of bounds Calls: ... pandoc_available -> find_pandoc -> lapply ->…
Cyrus Gong
  • 41
  • 2
4
votes
1 answer

RStudio creates PDF file from Rmarkdown in temporary directory

I use RStudio with Rmarkdown to create reports. For some reason using the “Knit” button results in it being created in some temporary directory only. From the command output it seems that pandoc itself is instructed to do so, which I find very…
Martin Ueding
  • 8,245
  • 6
  • 46
  • 92
4
votes
1 answer

List of figures in bookdown to html_document2

Is there any possibility to include a list of figures in my Rmd-Document? Right now my yaml-header looks like this, but I have no clue of how to include a list of figures. The \figureslift doesn't seem to work. --- title: "" author: "" output: …
Lenn
  • 1,283
  • 7
  • 20
4
votes
1 answer

How to import and run a python file in an rmarkdown chunk?

I have an r markdown document and a python script named sim1.py. I would like to import the python code into a chunk. In some cases I want it to run, and in other cases I just want the code pasted. So far I've tried using the child chunk option in…
Scott White
  • 190
  • 2
  • 14
4
votes
1 answer

Why inclusion of external Rmd-file with latex equation environment leads to different DOCX output while using rmarkdown and bookdown?

Below is the simplest Rmd file which I'm knitting to MS Word document using latest RStudio: --- output: word_document: default bookdown::word_document2: default --- ```{sh, echo=FALSE, comment=''} cat ~/latex-test.Rmd ``` The contents of…
N0rbert
  • 559
  • 5
  • 22
4
votes
2 answers

How to remove display of strange characters in R-Markdown chunk output?

I am getting frequencies from a few rasters and am doing so in R-Markdown. I am using lapply to get the frequencies from the rasters in a list. When I store those frequencies in a list of data.frames, the chunk output displays some unexpected…
Luke C
  • 10,081
  • 1
  • 14
  • 21
1 2 3
99
100