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
502
votes
14 answers

How to add new line in Markdown presentation?

How to add new line in Markdown presentation? I mean, something like \newline in TeX.
max04
  • 5,315
  • 3
  • 13
  • 21
315
votes
8 answers

YAML current date in rmarkdown

I'm wondering if there's a trick to put the current date in the YAML front-matter of a .rmd document to be processed by knitr and the rmarkdown package. I used to have the following line at the top of my wiki pages, _baptiste, `r…
baptiste
  • 75,767
  • 19
  • 198
  • 294
238
votes
4 answers

R - Markdown avoiding package loading messages

I have been using Knitr via R-Studio, and think it is pretty neat. I have a minor issue though. When I source a file in an R-Chunk, the knitr output includes external comments as follows: + FALSE Loading required package: ggplot2 + FALSE Loading…
Roark
  • 2,575
  • 2
  • 14
  • 8
214
votes
9 answers

Difference between R MarkDown and R NoteBook

I am trying to understand at a high level what the differences between R Markdown and R NoteBook. I know they are interrelated but I would like to figure out how they are related. My understanding is this: I know R Notebooks are really R Markdown…
PagMax
  • 8,088
  • 8
  • 25
  • 40
183
votes
3 answers

how to show underscores symbol in markdown?

in markdown, my_stock_index is mystockindex. But I want it to show my_stock_index. How can do that?
GoingMyWay
  • 16,802
  • 32
  • 96
  • 149
180
votes
4 answers

Insert picture/table in R Markdown

So I want to insert a table AND a picture into R Markdown. In regular word document I can just easily insert a table (5 rows by 2 columns), and for the picture just copy and paste. How do I insert a 5 row by 2 column table (and also type stuff into…
user3784616
  • 1,939
  • 3
  • 15
  • 10
143
votes
5 answers

Comment out text in R Markdown (Rmd file)

In an R Markdown (.Rmd) file, how do you comment out unused text? I'm not referring to the text in the R code chunk, but the general texts, like % in LaTex for example.
aonan zhang
  • 1,503
  • 2
  • 10
  • 6
135
votes
4 answers

How to add \newpage in Rmarkdown in a smart way?

I wonder if one could simply use LaTeX \newpage command in R markdown v2 in a different way than this: ```{r, results='asis', echo=FALSE} cat("\\newpage") ``` I produce pdf_output. If any1 has any idea please do not hesitate to comment :) !…
Marcin
  • 7,834
  • 8
  • 52
  • 99
132
votes
3 answers

How to combine two RMarkdown (.Rmd) files into a single output?

I have two files in the same folder: chapter1.Rmd and chapter2.Rmd, with the following content: chapter1.Rmd --- title: "Chapter 1" output: pdf_document --- ## This is chapter 1. {#Chapter1} Next up: [chapter 2](#Chapter2) chapter2.Rmd --- title:…
RobinLovelace
  • 4,799
  • 6
  • 29
  • 40
132
votes
8 answers

How to convert R Markdown to PDF?

I've previously asked about the commands for converting R Markdown to HTML. What is a good way to convert R Markdown files to PDF documents? A good solution would preserve as much as possible of the content (e.g., images, equations, html tables,…
Jeromy Anglim
  • 33,939
  • 30
  • 115
  • 173
122
votes
3 answers

How to add table of contents in Rmarkdown?

I am using RStudio for writing markdown documents and want to add Table of Contents (TOC) at top of the documents so that the user could click the relevant section for reading. There were some relevant examples on rpubs but now I can't seem to find…
umair durrani
  • 5,597
  • 8
  • 45
  • 85
121
votes
1 answer

Relationship between R Markdown, Knitr, Pandoc, and Bookdown

What is the relationship between the functionality of R Markdown, Knitr, Pandoc, and Bookdown? Specifically what is the 'division of labour' between these packages in converting markup documents with embedded R code (e.g. .Rnw or .Rmd) into final…
RobinL
  • 11,009
  • 8
  • 48
  • 68
115
votes
6 answers

How to show code but hide output in RMarkdown?

I want my html file to show the code, but not the output of this chunk: ```{r echo=True, include=FALSE} fun <- function(b) { for(a in b) {print(a) return(a * a)} } y <- fun(b) ``` When I run the code, i need the print to…
Laurent
  • 1,914
  • 2
  • 11
  • 25
113
votes
6 answers

Rstudio rmarkdown: both portrait and landscape layout in a single PDF

I wonder how to use rmarkdown to generate a pdf which has both portrait and landscape layout in the same document. If there is a pure rmarkdown option that would be even better than using latex. Here's a small, reproducible example. First, rendering…
user3712688
  • 1,151
  • 2
  • 8
  • 5
108
votes
8 answers

Programmatically creating Markdown tables in R with KnitR

I am just starting to learn about KnitR and the use of Markdown in generating R documents and reports. This looks to be perfect for a lot of the day to day reporting that I have to do with my job. However, one thing that I'm not seeing is an easy…
TARehman
  • 6,659
  • 3
  • 33
  • 60
1
2 3
99 100