During this session you’ll get a brief introduction to R Markdown. You’ll learn about the basic building blocks of an R Markdown file and learn how to knit an HTML notebook using RStudio1.
The only pre-requisite is having R and RStudio installed on your computer since the needed packages are installed by default. You don’t need much R programming knowledge to produce professionally marked up documents.
After completing this lesson you should be able to:
Create and edit an R Notebook from scratch.
Knit an R Notebook containing commonly used R Markdown commands into an HTML document.
Know where to get further information on more advanced R Markdown usage.
The materials for this lesson are derived heavily from the following places which are excellent resources in their own right:
R for Data Science (Grolemund and Wickham 2017)
R for Reproducible Scientific Analysis (Wright and Zimmerman 2016)
R Markdown: The Definitive Guide (Xie, Allaire, and Grolemund 2018)
rmarkdown: Dynamic Documents for R (GitHub page)
Some examples use the penguins
dataset found in the palmerpenguins
package (Horst, Hill, and Gorman 2020)
As an analyst you’ll regularly prepare reports to document your methods and communicate your findings. And these reports will likely contain a mixture of worded explanations, tables of data, and graphical figures. An R Markdown file, via the knitr
2 package, allows you to embed code for generating graphs and figures amongst other explanatory text – all within the one source file. Should you wish to change some text or fix an error you can at the click of a button recompile a new .HTML
, .PDF
, or .DOCX
report immediately.
Aside from the convenience of avoiding copy-pasting between different source documents, an R Notebook fully encapsulates your work and is easily shareable as reproducible research (see Peng 2014 for the distinction between reproducible and replicable). By sharing your R Notebook with collaborators or colleagues (sceptics?) they can take your data, code, and text, and reproduce the exact same analysis as you conducted.
According to Grolemund and Wickham (2017), R Markdown files are designed for use in three ways:
Communicating to decision makers who focus on conclusions rather than the code behind your analysis.
Collaborating with other analysts who are interested in both your conclusions and how you reached them.
As an environment in which to conduct analysis; a modern day lab notebook where you can capture both what you did and what you were thinking at the time.
RStudio includes all that you need to get started with creating an R Notebook. The rmarkdown
3 package comes already installed. The steps below create a new (HTML) notebook with file extension .Rmd
that’s pre-filled with some basic R Markdown content.
Launch RStudio
(Recommended) Create a new project (File, New Project…, New Directory )
Click File menu
Click New File \(\blacktriangleright\) R Markdown…
Choose Document from the list and enter “My Notebook” and your name into the Title and Author fields respectively.
Leave the Default Output Format as HTML and click OK.
From the steps above you might notice that R Markdown can be processed into various output types and formats, e.g., PDF Document, HTML slide presentation.
Exercise 1
Create a new RStudio project called “my-project.”
Create a new R Notebook entitled “My Notebook” with a Default Output Format of HTML.
Save the notebook as my-notebook.Rmd
.
Identify the YAML header, formatted text, and any ‘code chunks.’
.Rmd
filesFrom the exercise above you’ll have observed the three typical components of an R Markdown .Rmd
file, briefly:
Formatted text
Prose related to the presented analysis and results.
Code chunks
Executable R code producing outputs for embedding into the final document.
YAML header
Settings related to the generation of the final output document.
Run a code chunk by clicking the Run Current Chunk button (green arrow) within the chunk or (preferably) by placing the cursor inside the chunk and pressing Ctrl + Shift + Enter.
The output of the code chunk is displayed within the notebook inside the Source editor pane.
You can clear this output by clicking the Clear Output icon (small cross) found in the top right corner of the chunk output. You can also pop-out a separate output window or hide it altogether.
‘Knitting’ an R Notebook means to compile it into an output document.
When you knit an R Notebook the .Rmd
file is sent to knitr
which executes any code chunks and creates an intermediate Markdown .md
document. This .md
file contains both the code and its output and is processed by pandoc
4 into the finished file.
The advantage of this two-step workflow is being able to create a wide range of output formats from the same .Rmd
file. For example, slide presentations, dashboards, websites, and web apps.
To knit a notebook in RStudio, click the Knit button found in the toolbar of the Source editor pane, or use the keyboard shortcut Ctrl + Shift + K.
A preview of the knitted document will appear in its own window (or depending on your RStudio settings, in the Viewer pane).
Set your preferred preview location by clicking the white cog button and choosing Preview in Window or Preview in Viewer Pane.
If the output type specified in the YAML header is html_notebook
(rather than html_document
as above) a Preview Notebook button appears instead of a Knit button. Preview Notebook shows you a rendered HTML copy of the contents of the Source editor pane without first executing any R code, i.e., it only renders whatever results are already shown in the pane.
Exercise 2
Knit to HTML the notebook my-notebook.Rmd
that you created in Exercise 1.
Observe the correspondence between the R Markdown and the resultant document, particularly the R code embedded in the code chunks.
Make some changes to the .Rmd
file and re-knit the document. Perhaps delete some text or add head(cars)
or str(cars)
to an existing code chunk.
Confirm that you can see the changes reflected in the re-knitted document.
TIP: Use the keyboard shortcut Ctrl + Shift + K to save and knit a notebook in a single action.
Text in .Rmd
files is written in pandoc
R Markdown whose syntax is designed to be human-readable and suggestive of its final HTML rendering. In the examples below you’ll see that styled text is usually enclosed by special characters.
Headings are defined using hash #
characters. The more hashes, the less prominent the heading.
# Level 1 heading
## Level 2 heading
### Level 3 heading
Italic styling is applied using single asterisks or underscores: *italic*
or _italic_
Bold styling is applied using double asterisks or underscores: **bold**
or __bold__
Bold & italic styling is applied using triple asterisks or underscores: ***bold & italic***
or ___bold & italic___
Inline code
styling is applied using backticks: `plot(penguins)`
Superscripting is applied using carets: S^uperscripting^
Subscripting is applied using tildes: S~ubscripting~
Strikethrough is applied using double tildes: ~~Strikethrough~~
R code can be embedded inline by surrounding it in backticks `
and inserting a single r
character prefix. This code is executed and replaced with its output when the notebook is knitted.
The `cars` dataset has `r nrow(cars)` rows.
Output:
The cars
dataset has 50 rows.
Surrounding an expression with dollar symbols $
will have knitr
interpret it as in-line \(\LaTeX\) formatting.
Sum of integer powers of a half is $\sum_{n=1}^{\infty} 2^{-n} = 1$
Output:
Sum of integer powers of a half is \(\sum_{n=1}^{\infty} 2^{-n} = 1\)
Using double dollar symbols $$
will centre the equation on its own line.
Sum of integer powers of a half is $$\sum_{n=1}^{\infty} 2^{-n} = 1$$
Output:
Sum of integer powers of a half is \[\sum_{n=1}^{\infty} 2^{-n} = 1\]
Clickable URLs are inserted by enclosing the URL in greater-than <
and less-than >
symbols.
<http://example.com>
Output:
Linked text is enclosed in square parentheses []
followed by the URL in round parentheses ()
.
[hypertext link](http://example.com)
Output:
You can insert hyperlinked footnotes using square bracket and caret syntax [^footnoteID]
. The footnote ID can be any string of characters without spaces.
The numbering of footnotes is done automatically upon knitting.
AIC[^aic] is used to evaluate the relative quality of models.
Output:
AIC5 is used to evaluate the relative quality of models.
The definition of the footnote must appear in the R Notebook somewhere after it is first mentioned in the text. Notice the colon :
in the syntax.
[^aic]: AIC stands for Akaike Information Criterion.
The footnote itself appears at the end of the HTML document with a convenient hyperlink back to where it appears in the document.
Images are inserted by providing a file path to the image, either a link to a locally stored file or a URL to an image hosted online. Notice the leading exclamation mark !
and caption in square parentheses []
. Leave the square parentheses empty for no caption.
![source: [xkcd.com](https://xkcd.com/license.html)](https://imgs.xkcd.com/comics/purity.png)
Output:
Items of an unordered list are prefixed with an asterisk *
, hyphen -
, or plus +
. Increase the line spacing between bullet points by adding extra carriage returns and nest bullet points by prepending four blank spaces.
* An item
* Another item
* Nested item
* Another nested item
Output:
An item
Another item
Ordered lists are prefixed with numbers or letters.
Notice that the numbering is incremented automatically in the output even if typed out of order.
1. First item
2. Second item
a. First nested item
a. Second nested item
1. Third item
Output:
First nested item
Second nested item
Block quotations are created by prefixing each line with the greater-than symbol >
.
> First level of quoting
>
> > Nested block quotation
>
> Back to the first level
Output:
First level of quoting
Nested block quotation
Back to the first level
Manually create a static table using hyphens -
and pipes |
to indicate the header row and columns respectively. Rows are terminated by a carriage return.
First Header | Second Header | Third Header
------------- | ------------- | ------------
Cell content | Cell content | Cell content
Cell content | Cell content | Cell content
Output:
First Header | Second Header | Third Header |
---|---|---|
Cell content | Cell content | Cell content |
Cell content | Cell content | Cell content |
If the output of a code chunk is a table of values, R Markdown will render it accordingly.
```{r}
head(penguins)
```
Output:
head(penguins)
## # A tibble: 6 x 8
## species island bill_length_mm bill_depth_mm flipper_length_~ body_mass_g sex
## <fct> <fct> <dbl> <dbl> <int> <int> <fct>
## 1 Adelie Torge~ 39.1 18.7 181 3750 male
## 2 Adelie Torge~ 39.5 17.4 186 3800 fema~
## 3 Adelie Torge~ 40.3 18 195 3250 fema~
## 4 Adelie Torge~ NA NA NA NA <NA>
## 5 Adelie Torge~ 36.7 19.3 193 3450 fema~
## 6 Adelie Torge~ 39.3 20.6 190 3650 male
## # ... with 1 more variable: year <int>
To get nicer looking tables we can use the kable()
function from the knitr
package.
```{r}
kable(head(penguins))
```
Output:
kable(head(penguins))
species | island | bill_length_mm | bill_depth_mm | flipper_length_mm | body_mass_g | sex | year |
---|---|---|---|---|---|---|---|
Adelie | Torgersen | 39.1 | 18.7 | 181 | 3750 | male | 2007 |
Adelie | Torgersen | 39.5 | 17.4 | 186 | 3800 | female | 2007 |
Adelie | Torgersen | 40.3 | 18.0 | 195 | 3250 | female | 2007 |
Adelie | Torgersen | NA | NA | NA | NA | NA | 2007 |
Adelie | Torgersen | 36.7 | 19.3 | 193 | 3450 | female | 2007 |
Adelie | Torgersen | 39.3 | 20.6 | 190 | 3650 | male | 2007 |
Horizontal rules are inserted using three or more consecutive asterisks *
or hyphens -
.
---
Output:
Exercise 3
Remember to re-knit the notebook to see your changes.
Put a horizontal rule underneath the content in your R notebook from Exercise 2 (my-notebook.Rmd
).
Below the horizontal rule insert some text with inline R code, e.g., Mean bill length is `r mean(penguins$bill_length_mm)`
Insert a heading called “Table of Contents”
Under the heading, use an ordered list with nesting to create the outline of a typical scientific report, e.g., Introduction, Data Description, Methodology, etc.
You’ll see how to insert a nicer, autogenerated Table of Contents later.
Format some of the list items using the text styles mentioned above.
Insert a footnote into your notebook and include in its body a link to RStudio’s RMarkdown tutorial.
Exercise 4 (Optional)
Code is inserted into R Notebooks in ‘code chunks.’ Upon knitting, these chunks are executed and their results inserted directly into the finished document. Embedding code alongside prose annotations of your methods and results speaks to the ethos of reproducible research.
Code chunks are enclosed by three backticks ```
with a prefix of curly parentheses {}
containing parameters for that chunk (if any).
```{r Structure of penguins dataset}
install.packages("palmerpenguins")
library(palmerpenguins)
str(penguins)
```
In the above example the first parameter r
indicates that the chunk contains R code. knitr
provides support for many other languages such as Bash, Perl, SQL, Python, and Julia.
After the r
is an optional name for this chunk. This helps with finding the chunk in the code navigator found in the bottom left of the Source editor pane.
The knitted notebook will therefore include both the code and its output one after the other.
Output:
str(penguins)
## tibble [344 x 8] (S3: tbl_df/tbl/data.frame)
## $ species : Factor w/ 3 levels "Adelie","Chinstrap",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ island : Factor w/ 3 levels "Biscoe","Dream",..: 3 3 3 3 3 3 3 3 3 3 ...
## $ bill_length_mm : num [1:344] 39.1 39.5 40.3 NA 36.7 39.3 38.9 39.2 34.1 42 ...
## $ bill_depth_mm : num [1:344] 18.7 17.4 18 NA 19.3 20.6 17.8 19.6 18.1 20.2 ...
## $ flipper_length_mm: int [1:344] 181 186 195 NA 193 190 181 195 193 190 ...
## $ body_mass_g : int [1:344] 3750 3800 3250 NA 3450 3650 3625 4675 3475 4250 ...
## $ sex : Factor w/ 2 levels "female","male": 2 1 1 NA 1 2 1 2 NA NA ...
## $ year : int [1:344] 2007 2007 2007 2007 2007 2007 2007 2007 2007 2007 ...
Exercise 5
Add a new R chunk by clicking in your notebook where you want to insert the chunk and clicking the Insert button on the toolbar.
Alternatively use the Ctrl + Shift + I keyboard shortcut.
Name this chunk “summary penguins” and confirm that name appears in the code chunk navigation menu.
Add this R code into the chunk: summary(penguins)
.
Run the chunk by clicking the Run Current Chunk button or by pressing Ctrl + Shift + Enter.
Insert and run a couple more code chunks containing R code of your choosing.
Knit your notebook to HTML and check that the output is as you’d expect.
You can list in the curly parentheses {}
various options for changing how a chunk is knitted into the final document.
See https://yihui.name/knitr/options for all the available options; only a few commonly used options are shown here.
a) Show the code and the output (default)
```{r}
colMeans(penguins[,3:6], na.rm = TRUE)
```
Output:
colMeans(penguins[,3:6], na.rm = TRUE)
## bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
## 43.92193 17.15117 200.91520 4201.75439
b) eval=FALSE
shows the code but does not execute it
```{r, eval=FALSE}
colMeans(penguins[,3:6], na.rm = TRUE)
```
Output:
colMeans(penguins[,3:6], na.rm = TRUE)
c) echo=FALSE
shows the output but does not show the code
```{r, echo=FALSE}
colMeans(penguins[,3:6], na.rm = TRUE)
```
Output:
## bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
## 43.92193 17.15117 200.91520 4201.75439
d) include=FALSE
executes the code but does not show anything
```{r, include=FALSE}
colMeans(penguins[,3:6], na.rm = TRUE)
```
Output:
A special code chunk (if it exists) is the one named setup. The setup chunk is automatically run just before any other code chunk is executed. It is useful for loading R library
s and data used subsequent analyses.
```{r setup, include=FALSE}
library(knitr)
library(palmerpenguins)
```
Recall that include=FALSE
prevents the setup chunk from inserting any output into the knitted document.
Exercise 6
Duplicate (copy-paste) the code chunk from Exercise 5 but specify a different output option from amongst those mentioned above. Observe the different output in the knitted document.
HINT: instead of manually typing the output options, RStudio provides a shortcut by clicking the Modify Chunk Options icon (grey cog) found in the top right corner of the chunk next to the Run Current Chunk button.
The popup also has a Chunk options link to documentation on available chunk options.
Repeat for some other output options, observing their effect on the knitted output.
Below is an example of a chunk that produces a figure rather than numerical output, namely a boxplot of bill lengths (millimetres) from the penguins
dataset.
```{r bill length boxplot, echo=FALSE}
boxplot(bill_length_mm ~ species, data = penguins, col = hcl.colors(3), main = "Penguin Bill Lengths")
```
Output:
We can resize the plot using the fig.height
and fig.width
chunk options.
```{r bill length boxplot echo=FALSE, fig.height=3, fig.width=3}
boxplot(bill_length_mm ~ species, data = penguins, col = hcl.colors(3), main = "Penguin Bill Lengths")
```
Output:
Other useful options include:
fig.asp
for setting the figure aspect ratio
fig.dim
for specifying the figure width and height as a (width, height)
tuple
fig.align
for aligning the figure to the left, right, or centre of the page
See https://yihui.name/knitr/options/#plots for an extensive list.
Exercise 7
Check these exercises by re-running the edited code chunk and re-knitting the whole notebook. Sometimes the preview and document are different!
HINT: You may need to check the online documentation mentioned above.
Duplicate (copy-paste) the code chunk of one of the figures in your notebook (renaming it if necessary) and use the fig.asp
figure option to set its aspect ratio to be square, i.e., 1:1.
Now apply the fig.align
option to centre it on the page.
On a fresh duplicate of the code chunk, use fig.dim
to resize the figure to a width of 4 inches and height of 6 inches.
At the top of a .Rmd
file, enclosed by triple hyphens ---
, is the YAML6 header. It defines settings that affect the entire document, in particular specifying the output type.
Below is the default YAML header created by RStudio for new R Notebooks. It sets the R Markdown file to knit to an HTML notebook html_notebook
.
---
title: "R Notebook"
output: html_notebook
---
Other document output types include PDF, Word, and HTML documents (distinct from HTML notebook). Note that PDF output requires \(\LaTeX\) (see the tinytex
R package) and you obviously need Microsoft Word or an equivalent to preview Word outputs.
---
title: "R Document"
output:
pdf_document: default
word_document: default
html_document: default
---
Alternatively, you can produce a slide deck by setting the output parameter to be beamer_presentation
, ioslides_presentation
, or slidy_presentation
.
---
title: "R Slideshow"
output:
beamer_presentation: default
ioslides_presentation: default
slidy_presentation: default
---
See Chapter 4 of Xie, Allaire, and Grolemund (2018) for a full breakdown of these types.
The focus of this lesson is knitting HTML documents (the html_document
output type). There are many settings available as illustrated by the YAML header used in the .Rmd
file for this lesson:
---
title: "Introduction to R Markdown"
author: "[Shih Ching Fu](https://shihchingfu.com)"
date: "July 2021"
bibliography: ref.bib
output:
#slidy_presentation: default
html_document:
toc: true
toc_depth: 3
toc_float:
collapsed: true
smooth_scroll: true
number_sections: true
theme: readable
highlight: haddock
code_download: true
knit:
(function(input_file, encoding) {
rmarkdown::render(input_file,
encoding=encoding,
output_file=file.path(dirname(input_file), 'docs', 'index.html'))})
---
Many of these options also accessible via the “Output options…” item under the R Markdown format options menu (gear icon) in the source pane.
See Part II of Xie, Allaire, and Grolemund (2018) for full details of options for various output types.
R Markdown supports common bibliography formats such as BibTeX, BibLaTeX, and EndNote.
The path to the bibliography file must be specified in the YAML header under the bibliography
field.
---
title: "Introduction to R Markdown"
author: "[Shih Ching Fu](https://shihchingfu.com)"
date: "April 2021"
bibliography: ref.bib
---
Here’s a sample BibTeX record from the abovementioned ref.bib
file:
@book{xie2018RGuide,
author = "Yihui Xie and J.J. Allaire and Garrett Grolemund",
title = "R Markdown: The Definitive Guide",
year = "2018",
publisher = "CRC Press",
url = "https://bookdown.org/yihui/rmarkdown/"}
In-text citations are inserted using the at sign @
followed by the citation key.
Part II of @xie2018RGuide describes the various output formats available with R Markdown.
Output:
Part II of Xie, Allaire, and Grolemund (2018) describes the various output formats available with R Markdown.
Since version 1.4, RStudio has a “Visual Editor” mode for the Source pane. It is akin to the what you see is what you get (WYSIWIG) experience that comes with a word processor like Microsoft Word.
You can enable it from the format options menu (gear icon) in the source pane.
With this mode turned on the Source pane now shows a toolbar that has pretty much all the formatting options that are described above.
You might ask why bother with learning R markdown syntax now that there is a visual editor? Well, the choice is entirely up to you and indeed you can swap between them as you feel inclined. I’ve even it used it as a learning tool by composing a notebook in the Visual Editor and then inspecting the R Markdown syntax that is generated underneath!
Full documentation is available here: https://rstudio.github.io/visual-markdown-editing/.
There is much more to R Markdown than what’s covered here!
The sources mentioned in the bibliography below are good starting points for further developing your R Markdown expertise. Galleries such as https://yihui.name/knitr/demo/showcase/ are also a great place to start.
RStudio also provides ‘cheatsheets’ that are accessible from the Help menu. These are a convenient printable reference of commonly used syntax and commands.
May the knitr
be with you.
## - Session info ---------------------------------------------------------------
## setting value
## version R version 4.1.0 (2021-05-18)
## os Windows 10 x64
## system x86_64, mingw32
## ui RTerm
## language (EN)
## collate English_Australia.1252
## ctype English_Australia.1252
## tz Australia/Perth
## date 2021-07-01
##
## - Packages -------------------------------------------------------------------
## package * version date lib source
## bslib 0.2.5.1 2021-05-18 [1] CRAN (R 4.1.0)
## cachem 1.0.5 2021-05-15 [1] CRAN (R 4.1.0)
## callr 3.7.0 2021-04-20 [1] CRAN (R 4.1.0)
## cli 2.5.0 2021-04-26 [1] CRAN (R 4.1.0)
## crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.0)
## desc 1.3.0 2021-03-05 [1] CRAN (R 4.1.0)
## devtools 2.4.1 2021-05-05 [1] CRAN (R 4.1.0)
## digest 0.6.27 2020-10-24 [1] CRAN (R 4.1.0)
## ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
## evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0)
## fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0)
## fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.0)
## fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
## glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
## highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
## htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.1.0)
## jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.1.0)
## jsonlite 1.7.2 2020-12-09 [1] CRAN (R 4.1.0)
## knitr * 1.33 2021-04-24 [1] CRAN (R 4.1.0)
## lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.1.0)
## magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.0)
## memoise 2.0.0 2021-01-26 [1] CRAN (R 4.1.0)
## palmerpenguins * 0.1.0 2020-07-23 [1] CRAN (R 4.1.0)
## pillar 1.6.1 2021-05-16 [1] CRAN (R 4.1.0)
## pkgbuild 1.2.0 2020-12-15 [1] CRAN (R 4.1.0)
## pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
## pkgload 1.2.1 2021-04-06 [1] CRAN (R 4.1.0)
## prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.1.0)
## processx 3.5.2 2021-04-30 [1] CRAN (R 4.1.0)
## ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.0)
## purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
## R6 2.5.0 2020-10-28 [1] CRAN (R 4.1.0)
## remotes 2.4.0 2021-06-02 [1] CRAN (R 4.1.0)
## rlang 0.4.11 2021-04-30 [1] CRAN (R 4.1.0)
## rmarkdown 2.8 2021-05-07 [1] CRAN (R 4.1.0)
## rprojroot 2.0.2 2020-11-15 [1] CRAN (R 4.1.0)
## rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
## sass 0.4.0 2021-05-12 [1] CRAN (R 4.1.0)
## sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0)
## stringi 1.6.2 2021-05-17 [1] CRAN (R 4.1.0)
## stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
## testthat 3.0.2 2021-02-14 [1] CRAN (R 4.1.0)
## tibble 3.1.2 2021-05-16 [1] CRAN (R 4.1.0)
## usethis 2.0.1 2021-02-10 [1] CRAN (R 4.1.0)
## utf8 1.2.1 2021-03-12 [1] CRAN (R 4.1.0)
## vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.0)
## withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0)
## xfun 0.23 2021-05-15 [1] CRAN (R 4.1.0)
## yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0)
##
## [1] C:/Users/shihc/OneDrive/Documents/R/win-library/4.1
## [2] C:/Program Files/R/R-4.1.0/library
RStudio, https://www.rstudio.com/↩︎
knitr, http://yihui.name/knitr/↩︎
pandoc, http://pandoc.org/↩︎
AIC stands for Akaike Information Criterion.↩︎
YAML stands for YAML Ain’t Markup Language. It’s a recursive name!↩︎