Learn R Markdown

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Overview

R for Data Science

If you are new to using R Markdown, we encourage you to start with a systematic overview, rather than diving right in to reading documentation pages. The best place to start is the "Communication" section in the book "R for Data Science" (R4DS for short), an O’Reilly book written by Hadley Wickham and Garrett Grolemund.

Here are the chapters that cover R Markdown, as summarized by Hadley and Garrett:



R Markdown tutorials

Tutorials

The R Markdown website offers a series of tutorials you can follow to see what is possible with R Markdown.

These tutorials offer accompanying RStudio Cloud lessons you can use right away in your browser.

You can also access links to all these tutorials in the "Get Started" section from the top of this page.



User Guide

Written by the authors of the rmarkdown package, R Markdown: The Definitive Guide provides a comprehensive user guide to the complete R Markdown ecosystem for authoring documents. The book is published by Chapman & Hall/CRC, and you can read it online for free.

R Markdown: The Definitive Guide

The book is structured into four parts:



Going further wih examples

R Markdown Cookbook

R Markdown Cookbook provides a range of examples on how to extend the functionality of your R Markdown documents. As a cookbook, this guide is recommended to new and intermediate R Markdown users who desire to enhance the efficiency of using R Markdown and also explore the power of R Markdown. The book is published by Chapman & Hall/CRC, and you can read it online for free.

This cookbook is not a full technical reference for R Markdown but aims to supplement, instead of replace, the existing literature. The book is thus organized by topics with example as self-contained as possible so that readers can read this book with specific tasks in mind to do with R Markdown.

The topics are the following

# run this to update the content below
xfun::pkg_attach2("xml2")
html <- read_html("https://bookdown.org/yihui/rmarkdown-cookbook/")
chapters <- xml_find_all(html, "//li[@class='chapter']")
first_level <- chapters[which(purrr::map_lgl(xml_attr(chapters, 'data-level'), ~ grepl('^\\d+$', .x)))]
titles <- xml_text(xml_find_all(first_level, "a"))
titles <- gsub("^(\\d+)", "\\1.", titles)
titles <- gsub("^(.*) \\([*])$", "\\1", titles)
url <- file.path("https://bookdown.org/yihui/rmarkdown-cookbook", xml_attr(first_level, "data-path"))
formatted <- sprintf("* [%s](%s)", titles, url)
cat(formatted, sep = "\n")



Cheatsheets

R Markdown cheatsheet

The R Markdown cheatsheet is a one page (two-sided) reference guide you can download as a quick reference while you work.

You can access it from within the RStudio IDE:



Try the rmarkdown package in your browser

Any scripts or data that you put into this service are public.

rmarkdown documentation built on Nov. 4, 2024, 5:06 p.m.