Debian Codegraph @

vignettes/rmarkdown.Rmd

raw
1 ---
2 title: "Learn R Markdown"
3 output: rmarkdown::html_vignette
4 vignette: >
5 %\VignetteIndexEntry{Learn R Markdown}
6 %\VignetteEngine{knitr::rmarkdown}
7 %\VignetteEncoding{UTF-8}
8 ---
9
10 ```{r, include = FALSE}
11 knitr::opts_chunk$set(
12 collapse = TRUE,
13 comment = "#>"
14 )
15 ```
16
17
18
19 # Overview
20
21 <a href="https://r4ds.had.co.nz/"><img src="https://r4ds.had.co.nz/cover.png" alt="R for Data Science" data-external=1 width="250" style="padding: 0 15px; float: right;"/></a>
22
23 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](https://r4ds.had.co.nz/communicate-intro.html) in the book "R for Data Science" (R4DS for short), an O’Reilly book written by Hadley Wickham and Garrett Grolemund.
24
25 Here are the chapters that cover R Markdown, as summarized by Hadley and Garrett:
26
27 * In [R Markdown](https://r4ds.had.co.nz/r-markdown.html), you will learn about R Markdown, a tool for integrating
28 prose, code, and results. You can use R Markdown in notebook mode for
29 analyst-to-analyst communication, and in report mode for
30 analyst-to-decision-maker communication. Thanks to the power of R Markdown
31 formats, you can even use the same document for both purposes.
32
33 * In [R Markdown formats](https://r4ds.had.co.nz/r-markdown-formats.html), you'll learn a little about the many other varieties
34 of outputs you can produce using R Markdown, including dashboards, websites,
35 and books.
36
37 * We'll finish up with [R Markdown workflow](https://r4ds.had.co.nz/r-markdown-workflow.html), where you'll learn about the
38 "analysis notebook" and how to systematically record your successes and failures so that you can learn from them.
39
40 <br>
41 <br>
42
43 <a href="https://rmarkdown.rstudio.com/lesson-1.html"><img src="https://rmarkdown.rstudio.com/lesson-images/params-1-hawaii.png" alt="R Markdown tutorials" data-external=1 width="450" style="padding: 0 15px; float: right;"/></a>
44
45 # Tutorials
46
47 The [R Markdown website](https://rmarkdown.rstudio.com/lesson-1.html) offers a series of tutorials you can follow to see what is possible with R Markdown.
48
49 These tutorials offer accompanying [RStudio Cloud](https://rstudio.cloud/) lessons you can use right away in your browser.
50
51 You can also access links to all these tutorials in the **"Get Started"** section from the top of this page.
52
53 <br>
54 <br>
55
56 # User Guide
57
58 Written by the authors of the **rmarkdown** package, [R Markdown: The Definitive Guide](https://yihui.org/rmarkdown/) 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.
59
60 <a href="https://yihui.org/rmarkdown/"><img src="https://yihui.org/rmarkdown/images/cover.png" alt="R Markdown: The Definitive Guide" data-external=1 width="250" style="padding: 0 15px; float: right;"/></a>
61
62 The book is structured into four parts:
63
64 * [Part I](https://yihui.org/rmarkdown/installation.html) introduces how to install the relevant packages, and provides an overview of R Markdown, including the possible output formats, the Markdown syntax, the R code chunk syntax, and how to use other languages in R Markdown.
65
66 * [Part II](https://yihui.org/rmarkdown/documents.html) is the detailed documentation of built-in output formats in the rmarkdown package, including document formats and presentation formats. These output formats are "built-in" because you do not need any other R packages other than rmarkdown to use them.
67
68 * [Part III](https://yihui.org/rmarkdown/dashboards.html) documents several R Markdown extension packages that enable you to build different applications or generate output documents with different styles. These output formats are "extensions" because you will need to install R packages, in addition to rmarkdown, to use them.
69
70 * [Part IV](https://yihui.org/rmarkdown/parameterized-reports.html) covers advanced topics about R Markdown.
71
72 <br>
73 <br>
74
75 # Going further with examples
76
77 <a href="https://yihui.org/rmarkdown-cookbook/"><img src="https://yihui.org/rmarkdown-cookbook/images/cover.png" alt="R Markdown Cookbook" data-external=1 width="250" style="padding: 0 15px; float: right;"/></a>
78
79 [R Markdown Cookbook](https://yihui.org/rmarkdown-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.
80
81 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.
82
83 The topics are the following
84
85 ```{r, results='asis', echo = FALSE, eval = FALSE}
86 # run this to update the content below
87 xfun::pkg_attach2("xml2")
88 html <- read_html("https://yihui.org/rmarkdown-cookbook/")
89 chapters <- xml_find_all(html, "//li[@class='chapter']")
90 first_level <- chapters[which(purrr::map_lgl(xml_attr(chapters, 'data-level'), ~ grepl('^\\d+$', .x)))]
91 titles <- xml_text(xml_find_all(first_level, "a"))
92 titles <- gsub("^(\\d+)", "\\1.", titles)
93 titles <- gsub("^(.*) \\([*])$", "\\1", titles)
94 url <- file.path("https://yihui.org/rmarkdown-cookbook", xml_attr(first_level, "data-path"))
95 formatted <- sprintf("* [%s](%s)", titles, url)
96 cat(formatted, sep = "\n")
97 ```
98
99 * [1. Installation](https://yihui.org/rmarkdown-cookbook/installation.html)
100 * [2. Conceptual Overview](https://yihui.org/rmarkdown-cookbook/conceptual-overview.html)
101 * [3. Basics](https://yihui.org/rmarkdown-cookbook/basics.html)
102 * [4. Document Elements](https://yihui.org/rmarkdown-cookbook/document-elements.html)
103 * [5. Formatting](https://yihui.org/rmarkdown-cookbook/formatting.html)
104 * [6. LaTeX Output](https://yihui.org/rmarkdown-cookbook/latex-output.html)
105 * [7. HTML Output](https://yihui.org/rmarkdown-cookbook/html-output.html)
106 * [8. Word](https://yihui.org/rmarkdown-cookbook/word.html)
107 * [9. Multiple Output Formats](https://yihui.org/rmarkdown-cookbook/multi-formats.html)
108 * [10. Tables](https://yihui.org/rmarkdown-cookbook/tables.html)
109 * [11. Chunk Options](https://yihui.org/rmarkdown-cookbook/chunk-options.html)
110 * [12. Output Hooks](https://yihui.org/rmarkdown-cookbook/output-hooks.html)
111 * [13. Chunk Hooks](https://yihui.org/rmarkdown-cookbook/chunk-hooks.html)
112 * [14. Miscellaneous knitr Tricks](https://yihui.org/rmarkdown-cookbook/knitr-misc.html)
113 * [15. Other Languages](https://yihui.org/rmarkdown-cookbook/other-languages.html)
114 * [16. Managing Projects](https://yihui.org/rmarkdown-cookbook/managing-projects.html)
115 * [17. Workflow](https://yihui.org/rmarkdown-cookbook/workflow.html)
116
117 <br>
118 <br>
119
120 # Cheatsheets
121
122 <a href="https://raw.githubusercontent.com/rstudio/cheatsheets/main/rmarkdown.pdf"><img src="https://raw.githubusercontent.com/rstudio/cheatsheets/main/pngs/rmarkdown.png" alt="R Markdown cheatsheet" data-external=1 width="400" style="padding: 0 15px; float: right;"/></a>
123
124 The [R Markdown cheatsheet](https://raw.githubusercontent.com/rstudio/cheatsheets/main/rmarkdown.pdf) is a one page (two-sided) reference guide you can download as a quick reference while you work.
125
126 You can access it from within the RStudio IDE:
127
128 - *Help > Cheatsheets >
129 R Markdown Cheat Sheet*