forked from njtierney/qmd4sci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installation.qmd
83 lines (54 loc) · 2.15 KB
/
installation.qmd
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Installation
In this section, the aim is to have everyone setup with R, RStudio, and RMarkdown.
## Overview
* **Duration** 15 minutes
## Questions
* How do I install R?
* How do I install rmarkdown?
* How do I install LaTeX in a sane way?
## Software Setup
### R
#### Windows
https://cloud.r-project.org/bin/windows/
#### MacOS
https://cloud.r-project.org/bin/macosx/
#### Linux
https://cloud.r-project.org/bin/linux/
### RStudio
https://www.rstudio.com/products/rstudio/download/#download
## RMarkdown
To ensure you are up to date, run the following script to install the packages.
```{r install-rmd, eval = FALSE}
install.packages("rmarkdown")
install.packages("knitr")
install.packages("tinytex")
install.packages("here")
install.packages("tidyverse")
install.packages("broom")
install.packages("fs")
install.packages("usethis")
```
## A note on PDF
rmarkdown documents can be compiled to PDF, which is a great feature. In order to convert the documents to PDF, they use a software called LaTeX (\LaTeX) (pronounced la-tek or lay-tek).
Installing LaTeX [can be a pain](https://yihui.name/tinytex/pain/), but thankfully there is an easier way to install it - [`tinytex`](https://yihui.name/tinytex/). `tinytex` is an R package that installs a sane, lightweight (<200Mb) version of LaTeX.
```{r run-tiny-tex, eval = FALSE}
tinytex::install_tinytex()
```
If you get the following error, **this is good**! As it means that TeX has already been installed:
```
Error: Detected an existing tlmgr at /usr/local/bin/tlmgr. It seems TeX Live has been installed (check tinytex::tinytex_root()). You have to uninstall it, or use install_tinytex(force = TRUE) if you are sure TinyTeX can override it (e.g., you are a PATH expert or installed TinyTeX previously).
```
### Problem solving with LaTeX
If you have any problems with installing `tinytex`, I recommend you check out the [tinytex FAQ page](https://yihui.name/tinytex/faq/).
## Test Script
You should be able to run the following code on your machine
```{r library-test, eval = FALSE}
library(rmarkdown)
library(knitr)
library(tinytex)
library(here)
library(tidyverse)
library(broom)
library(fs)
library(usethis)
```