-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpackages.qmd
More file actions
58 lines (37 loc) · 2.48 KB
/
packages.qmd
File metadata and controls
58 lines (37 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
title: "Data and code"
date-modified: 'today'
date-format: long
license: CC BY-NC
bibliography: references.bib
---
## Download R & RStudio
Remember. R and RStudio are not the same thing. It's a good idea to have up-to-date installations. As of this writing, the easiest way to find both applications for local download are from the post.co page

## Install R, RStudio, R packages
I recommend this Interactive [tutorial](https://tutorials.shinyapps.io/00-setup/ "how to install R, RStudio, and packages") for a nice interactive tutorial on installing R, RStudio, packages.
## Quarto installation
Quarto comes pre-installed with the latest versions of RStudio. However, if you want to install Quarto again, or for use with VSCode, learn how at [Quarto.org](https://quarto.org/docs/get-started/ "Get Started with Quarto")
## Install packages
Packages can be installed with the `install.packages()` function. Alternatively, from within RStudio \> Packages \> install
::: column-margin
```{=html}
<iframe width="300" height="200" src="https://www.youtube.com/embed/v4tmOymwznQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
```
:::

::: callout-important
## Install Once!
You only have to install a package once and should avoid putting the `install.packages()` function in your scripts. Of course, you will need to update packages from time to time.
:::
## Load packages
You should load packages at the top of your script. Then write your script. Then Run All
::: {layout-ncol="2"}
[{fig-alt="Load packages"}](images/packages_load.jpg)
[{fig-alt="Run packages" width="175"}](images/packages_run.jpg)
:::
## Loading the tidyverse
::: {layout-ncol="2"}

[Tidyverse](https://tidyverse.org "tidyverse") [@wickham2019] is a concept but also a package. More accurately it's a meta-package that loads about eight other packages. When you type `load(tidyverse)`, there's no need to also load `ggplot2`, `dplyr`, `lubridate` or any of the packages that tidyverse loads. Redundantly, it's fine to write multiple load statements, but check the feedback from the code-chunk and you'll see what is being loaded by `load(tidyverse)`.
:::