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
95
votes
4 answers

Hiding the R code in Rmarkdown/knit and just showing the results

In my R Markdown documents, I sometimes want to just generate a report without showing the actual code (specially when I send it to my boss). How can I hide the R code and just show the graph and results? For example: --- output:…
Mark
  • 10,754
  • 20
  • 60
  • 81
89
votes
8 answers

RMarkdown: How to change the font color?

In RMarkdown is there a way to specify the font color? There doesn't seem to be an option while browsing through the chunk options
xiaodai
  • 14,889
  • 18
  • 76
  • 140
84
votes
6 answers

R Markdown - changing font size and font type in html output

I am using R Markdown in RStudio and the knit HTML option to create HTML output. However, the font used in the ouput for plain text blocks is rather small and I would like to change it to a differnt font and increase the font size. Can someone show…
Bärbel
  • 995
  • 1
  • 8
  • 7
83
votes
14 answers

Centering image and text in R Markdown for a PDF report

I want to center an image and/or text using R Markdown and knit a PDF report out of it. I have tried using: ->Text<- ->![](image1.jpg)<- That does not do the trick! Any other way of getting this done?
Next Door Engineer
  • 2,818
  • 4
  • 20
  • 33
81
votes
2 answers

Adjust the output width of R Markdown HTML output

I am producing an HTML output but I am having issues with the output width of R code output. I'm able to adjust the figure width with no difficulty but when I try to write a data table or the factor loadings, R is outputting at a fixed width which…
Matt Weller
  • 2,684
  • 2
  • 21
  • 30
79
votes
12 answers

pandoc version 1.12.3 or higher is required and was not found (R shiny)

I have a problem generating a pdf report from my app shiny which is hosted on a server. the app works fine but when I press the button to download the report, I get this error : pandoc version 1.12.3 or higher is required and was not found. The…
Daniele Avancini
  • 899
  • 1
  • 10
  • 14
78
votes
2 answers

Remove Hashes in R Output from R Markdown and Knitr

I am using RStudio to write my R Markdown files. How can I remove the hashes (##) in the final HTML output file that are displayed before the code output? As an example: --- output: html_document --- ```{r} head(cars) ```
mchangun
  • 9,814
  • 18
  • 71
  • 101
76
votes
8 answers

rmarkdown: pandoc: pdflatex not found

When I use the render{rmarkdown} to produce pdf file from .Rmd file on my Mac, an error message says pandoc: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed However when I check with pdflatex -v I…
askming
  • 925
  • 1
  • 6
  • 8
74
votes
2 answers

"long vectors not supported yet" error in Rmd but not in R Script

I am operating matrices with R 3.1 and RStudio 0.99. I have my R Script and with cmd+enter it works without problem. I created an Rmd for reporting but I have this error Error in lazyLoadDBinsertVariable(vars[i], from, datafile, ascii, compress, :…
pachadotdev
  • 3,345
  • 6
  • 33
  • 60
73
votes
8 answers

multiple authors and subtitles in Rmarkdown yaml

I'm trying to follow this pandoc example to add multiple authors to an Rmarkdown file in the yaml metadata block. The pdf will generate in RStudio (Version 0.98.932), but there is no author information. --- title: 'This is the title: it contains a…
Eric Green
  • 7,385
  • 11
  • 56
  • 102
73
votes
2 answers

Plot size and resolution with R markdown, knitr, pandoc, beamer

Doesn't fit on the slide by default, doesn't even print by any other means. Here's the .Rmd: Edit: it seems you have to use plot() in every chunk. Second plot now prints. # Plot should show at high resolution ```{r echo=FALSE, comment = ""} # load…
nacnudus
  • 6,328
  • 5
  • 33
  • 47
73
votes
4 answers

How to convert R Markdown to HTML? I.e., What does "Knit HTML" do in Rstudio 0.96?

What commands are run when pressing "Knit HTML" on an R Markdown file in Rstudio 0.96? My motivation is that I might want to run the same command when I'm in another text editing environment or I might want to combine the command in a larger…
Jeromy Anglim
  • 33,939
  • 30
  • 115
  • 173
69
votes
2 answers

Simple manual RMarkdown tables that look good in HTML, PDF and DOCX

How can I manually and simply format a table in RMarkdown that will look good when converted to HTML (using the knitr and markdown packages), PDF (using pandoc and miktex) and docx (using pandoc)? I want to be able to write small tables in…
Ben
  • 41,615
  • 18
  • 132
  • 227
69
votes
1 answer

knitr/Rmd: page break after n lines/n distance

Let me caveat by saying that this may be better suited as an html/css question but (a) I'm not too familiar with those techniques and (b) I wanted to keep it all in the family (R family) if possible. I would like to use knitr to write academic style…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
68
votes
4 answers

knitr/rmarkdown/Latex: How to cross-reference figures and tables?

I'm trying to cross-reference figures and tables in a PDF produced with knitr/rmarkdown. There are some questions on SO and tex.stackexchange (here and here, for example), that suggest the way to do this inline is to add \ref{fig:my_fig}, where…
eipi10
  • 91,525
  • 24
  • 209
  • 285