396 lines
12 KiB
HTML
Raw Normal View History

2025-01-12 00:52:51 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Learn R Markdown</title>
<script>// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});
</script>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<style type="text/css">body {
background-color: #fff;
margin: 1em auto;
max-width: 700px;
overflow: visible;
padding-left: 2em;
padding-right: 2em;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.35;
}
#TOC {
clear: both;
margin: 0 0 10px 10px;
padding: 4px;
width: 400px;
border: 1px solid #CCCCCC;
border-radius: 5px;
background-color: #f6f6f6;
font-size: 13px;
line-height: 1.3;
}
#TOC .toctitle {
font-weight: bold;
font-size: 15px;
margin-left: 5px;
}
#TOC ul {
padding-left: 40px;
margin-left: -1.5em;
margin-top: 5px;
margin-bottom: 5px;
}
#TOC ul ul {
margin-left: -2em;
}
#TOC li {
line-height: 16px;
}
table {
margin: 1em auto;
border-width: 1px;
border-color: #DDDDDD;
border-style: outset;
border-collapse: collapse;
}
table th {
border-width: 2px;
padding: 5px;
border-style: inset;
}
table td {
border-width: 1px;
border-style: inset;
line-height: 18px;
padding: 5px 5px;
}
table, table th, table td {
border-left-style: none;
border-right-style: none;
}
table thead, table tr.even {
background-color: #f7f7f7;
}
p {
margin: 0.5em 0;
}
blockquote {
background-color: #f6f6f6;
padding: 0.25em 0.75em;
}
hr {
border-style: solid;
border: none;
border-top: 1px solid #777;
margin: 28px 0;
}
dl {
margin-left: 0;
}
dl dd {
margin-bottom: 13px;
margin-left: 13px;
}
dl dt {
font-weight: bold;
}
ul {
margin-top: 0;
}
ul li {
list-style: circle outside;
}
ul ul {
margin-bottom: 0;
}
pre, code {
background-color: #f7f7f7;
border-radius: 3px;
color: #333;
white-space: pre-wrap;
}
pre {
border-radius: 3px;
margin: 5px 0px 10px 0px;
padding: 10px;
}
pre:not([class]) {
background-color: #f7f7f7;
}
code {
font-family: Consolas, Monaco, 'Courier New', monospace;
font-size: 85%;
}
p > code, li > code {
padding: 2px 0px;
}
div.figure {
text-align: center;
}
img {
background-color: #FFFFFF;
padding: 2px;
border: 1px solid #DDDDDD;
border-radius: 3px;
border: 1px solid #CCCCCC;
margin: 0 5px;
}
h1 {
margin-top: 0;
font-size: 35px;
line-height: 40px;
}
h2 {
border-bottom: 4px solid #f7f7f7;
padding-top: 10px;
padding-bottom: 2px;
font-size: 145%;
}
h3 {
border-bottom: 2px solid #f7f7f7;
padding-top: 10px;
font-size: 120%;
}
h4 {
border-bottom: 1px solid #f7f7f7;
margin-left: 8px;
font-size: 105%;
}
h5, h6 {
border-bottom: 1px solid #ccc;
font-size: 105%;
}
a {
color: #0033dd;
text-decoration: none;
}
a:hover {
color: #6666ff; }
a:visited {
color: #800080; }
a:visited:hover {
color: #BB00BB; }
a[href^="http:"] {
text-decoration: underline; }
a[href^="https:"] {
text-decoration: underline; }
code > span.kw { color: #555; font-weight: bold; }
code > span.dt { color: #902000; }
code > span.dv { color: #40a070; }
code > span.bn { color: #d14; }
code > span.fl { color: #d14; }
code > span.ch { color: #d14; }
code > span.st { color: #d14; }
code > span.co { color: #888888; font-style: italic; }
code > span.ot { color: #007020; }
code > span.al { color: #ff0000; font-weight: bold; }
code > span.fu { color: #900; font-weight: bold; }
code > span.er { color: #a61717; background-color: #e3d2d2; }
</style>
</head>
<body>
<h1 class="title toc-ignore">Learn R Markdown</h1>
<div id="overview" class="section level1">
<h1>Overview</h1>
<p><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></p>
<p>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 <a href="https://r4ds.had.co.nz/communicate-intro.html">“Communication”
section</a> in the book “R for Data Science” (R4DS for short), an
OReilly book written by Hadley Wickham and Garrett Grolemund.</p>
<p>Here are the chapters that cover R Markdown, as summarized by Hadley
and Garrett:</p>
<ul>
<li><p>In <a href="https://r4ds.had.co.nz/r-markdown.html">R
Markdown</a>, you will learn about R Markdown, a tool for integrating
prose, code, and results. You can use R Markdown in notebook mode for
analyst-to-analyst communication, and in report mode for
analyst-to-decision-maker communication. Thanks to the power of R
Markdown formats, you can even use the same document for both
purposes.</p></li>
<li><p>In <a href="https://r4ds.had.co.nz/r-markdown-formats.html">R
Markdown formats</a>, youll learn a little about the many other
varieties of outputs you can produce using R Markdown, including
dashboards, websites, and books.</p></li>
<li><p>Well finish up with <a href="https://r4ds.had.co.nz/r-markdown-workflow.html">R Markdown
workflow</a>, where youll learn about the “analysis notebook” and how
to systematically record your successes and failures so that you can
learn from them.</p></li>
</ul>
<p><br> <br></p>
<p><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></p>
</div>
<div id="tutorials" class="section level1">
<h1>Tutorials</h1>
<p>The <a href="https://rmarkdown.rstudio.com/lesson-1.html">R Markdown
website</a> offers a series of tutorials you can follow to see what is
possible with R Markdown.</p>
<p>These tutorials offer accompanying <a href="https://rstudio.cloud/">RStudio Cloud</a> lessons you can use
right away in your browser.</p>
<p>You can also access links to all these tutorials in the <strong>“Get
Started”</strong> section from the top of this page.</p>
<p><br> <br></p>
</div>
<div id="user-guide" class="section level1">
<h1>User Guide</h1>
<p>Written by the authors of the <strong>rmarkdown</strong> package, <a href="https://bookdown.org/yihui/rmarkdown/">R Markdown: The Definitive
Guide</a> provides a comprehensive user guide to the complete R Markdown
ecosystem for authoring documents. The book is published by Chapman
&amp; Hall/CRC, and you can read it online for free.</p>
<p><a href="https://bookdown.org/yihui/rmarkdown/"><img src="https://bookdown.org/yihui/rmarkdown/images/cover.png" alt="R Markdown: The Definitive Guide" data-external="1" width="250" style="padding: 0 15px; float: right;" /></a></p>
<p>The book is structured into four parts:</p>
<ul>
<li><p><a href="https://bookdown.org/yihui/rmarkdown/installation.html">Part I</a>
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.</p></li>
<li><p><a href="https://bookdown.org/yihui/rmarkdown/documents.html">Part II</a>
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.</p></li>
<li><p><a href="https://bookdown.org/yihui/rmarkdown/dashboards.html">Part III</a>
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.</p></li>
<li><p><a href="https://bookdown.org/yihui/rmarkdown/parameterized-reports.html">Part
IV</a> covers advanced topics about R Markdown.</p></li>
</ul>
<p><br> <br></p>
</div>
<div id="going-further-wih-examples" class="section level1">
<h1>Going further wih examples</h1>
<p><a href="https://bookdown.org/yihui/rmarkdown-cookbook/"><img src="https://bookdown.org/yihui/rmarkdown-cookbook/images/cover.png" alt="R Markdown Cookbook" data-external="1" width="250" style="padding: 0 15px; float: right;" /></a></p>
<p><a href="https://bookdown.org/yihui/rmarkdown-cookbook/">R Markdown
Cookbook</a> 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 &amp; Hall/CRC, and you can
read it online for free.</p>
<p>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.</p>
<p>The topics are the following</p>
<ul>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/installation.html">1.
Installation</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/conceptual-overview.html">2.
Conceptual Overview</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/basics.html">3.
Basics</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/document-elements.html">4.
Document Elements</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/formatting.html">5.
Formatting</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/latex-output.html">6.
LaTeX Output</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/html-output.html">7.
HTML Output</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/word.html">8.
Word</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/multi-formats.html">9.
Multiple Output Formats</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/tables.html">10.
Tables</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/chunk-options.html">11.
Chunk Options</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/output-hooks.html">12.
Output Hooks</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/chunk-hooks.html">13.
Chunk Hooks</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/knitr-misc.html">14.
Miscellaneous knitr Tricks</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/other-languages.html">15.
Other Languages</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/managing-projects.html">16.
Managing Projects</a></li>
<li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/workflow.html">17.
Workflow</a></li>
</ul>
<p><br> <br></p>
</div>
<div id="cheatsheets" class="section level1">
<h1>Cheatsheets</h1>
<p><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></p>
<p>The <a href="https://raw.githubusercontent.com/rstudio/cheatsheets/main/rmarkdown.pdf">R
Markdown cheatsheet</a> is a one page (two-sided) reference guide you
can download as a quick reference while you work.</p>
<p>You can access it from within the RStudio IDE:</p>
<ul>
<li><em>Help &gt; Cheatsheets &gt;<br />
R Markdown Cheat Sheet</em></li>
</ul>
</div>
<!-- code folding -->
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>