How to add table of contents in Rmarkdown?

The syntax is — title: “Sample Document” output: html_document: toc: true theme: united — in the documentation. Make sure this is at the beginning of your document. Also make sure your document actually has headers otherwise R can’t tell what you want in the table of contents.

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

August, 2018 update: This answer was written before the advent of bookdown, which is a more powerful approach to writing Rmarkdown based books. Check out the minimal bookdown example in @Mikey-Harper’s answer! When I want to break a large report into separate Rmd, I usually create a parent Rmd and include the chapters as children. … Read more

How to convert R Markdown to PDF?

Updated Answer (10 Feb 2013) rmarkdown package: There is now an rmarkdown package available on github that interfaces with Pandoc. It includes a render function. The documentation makes it pretty clear how to convert rmarkdown to pdf among a range of other formats. This includes including output formats in the rmarkdown file or running supplying … Read more

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

Simply \newpage or \pagebreak will work, e.g. hello world \newpage “`{r, echo=FALSE} 1+1 “` \pagebreak “`{r, echo=FALSE} plot(1:10) “` This solution assumes you are knitting PDF. For HTML, you can achieve a similar effect by adding a tag <P style=”page-break-before: always”>. Note that you likely won’t see a page break in your browser (HTMLs don’t … Read more

Insert picture/table in R Markdown [closed]

Several sites provide reasonable cheat sheets or HOWTOs for tables and images. Top on my list are: Pandoc readme, specifically tables RStudio’s RMarkdown, more details in basics (including tables) and a rewrite of pandoc’s markdown. Pictures are very simple to use but do not offer the ability to adjust the image to fit the page … Read more

YAML current date in rmarkdown

This is a little bit tricky, but you just need to make the date field valid in YAML by quoting the inline R expression, e.g. date: “`r format(Sys.time(), ‘%d %B, %Y’)`” Then the parsing error will be gone, and the date will be generated in the markdown output so Pandoc can use the value from … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)