-
Notifications
You must be signed in to change notification settings - Fork 6
/
install_rmarkdown.Rmd
79 lines (50 loc) · 5.27 KB
/
install_rmarkdown.Rmd
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
---
title: 'Installing R Markdown'
output:
html_document:
toc: yes
toc_depth: 3
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, tidy.opts=list(width.cutoff=55),tidy=TRUE)
```
\
###Installing R Markdown on a compter running MS Windows
This guide assumes you have already installed [R](https://www.r-project.org) and the [RStudio IDE](https://www.rstudio.com). RStudio is not required but recommended, because it makes it easier to work with R Markdown. If you do not have RStudio IDE installed, you will also have to install [Pandoc](http://pandoc.org). If you have RStudio installed there is no need to install Pandoc separately because its bundled with RStudio. Next you can install the rmarkdown package in RStudio using the following code:
```{r, eval = FALSE}
# Install from CRAN
install.packages('rmarkdown', dep = TRUE)
```
You will also need to install a bunch of additional R packages on which rmarkdown depends.
If you want to generate PDF output, you will need to install LaTeX. For R Markdown users who have not installed LaTeX before, we recommend that you install [TinyTeX](https://yihui.name/tinytex/). You can install TinyTex from within RStudio using the following code:
```{r, eval = FALSE}
install.packages('tinytex')
tinytex::install_tinytex() # install TinyTeX
```
TinyTeX is a lightweight, portable, cross-platform, and easy-to-maintain LaTeX distribution. The R companion package tinytex can help you automatically install missing LaTeX packages when compiling LaTeX or R Markdown documents to PDF. An alternative option would be to install MiKTeX instead. You can download the latest distribution of [MiKTeX](https://miktex.org/download). Installing MiKTeX is pretty straight forward, but it can sometimes be a pain to get it to play nicely with RStudio. If at all possible we recommend that you use TinyTex.
With the rmarkdown package, RStudio/Pandoc, and LaTeX, you should be able to compile most R Markdown documents.
\
###Installing R Markdown on a compter running Mac OSX
This guide assumes you have already installed [R](https://www.r-project.org) and the [RStudio IDE](https://www.rstudio.com). RStudio is not required but recommended, because it makes it easier to work with R Markdown. If you do not have RStudio IDE installed, you will also have to install [Pandoc](http://pandoc.org). If you have RStudio installed there is no need to install Pandoc separately because its bundled with RStudio. Next you can install the rmarkdown package in RStudio using the following code:
```{r, eval = FALSE}
# Install from CRAN
install.packages('rmarkdown', dep = TRUE)
```
You will also need to install a bunch of additional R packages on which rmarkdown depends.
If you want to generate PDF output, you will need to install LaTeX. For R Markdown users who have not installed LaTeX before, we recommend that you install [TinyTeX](https://yihui.name/tinytex/). You can install TinyTex from within RStudio using the following code:
```{r, eval = FALSE}
install.packages('tinytex')
tinytex::install_tinytex() # install TinyTeX
```
TinyTeX is a lightweight, portable, cross-platform, and easy-to-maintain LaTeX distribution. The R companion package tinytex can help you automatically install missing LaTeX packages when compiling LaTeX or R Markdown documents to PDF.
If for some reason TinyTeX does not work on your Mac computer then you can try to install MacTeX instead. You can download the latest version of [MacTeX](http://www.tug.org/mactex/mactex-download.html). Click on the *MacTeX.pkg* link to download. Please be aware that the file is quite large, approximately 3 GB, so it may take some time (also make sure you have enough available space on your computer hard disk). When your download is complete, run the downloaded installer. The installation procedure is quite straightforward. You are given a few options, for example you can choose not to install some components. I recommend you stick with the default settings, so having accepted the license agreement, you can basically just keep clicking 'Continue' on each screen. On the final screen of the wizard, click Install. It may ask for an administrator password. Enter the password, click 'Install Software' and go make a cup of coffee while the installation completes. When the program is done installing, click 'Close' to complete the installation.
With the rmarkdown package, RStudio/Pandoc, and LaTeX, you should be able to compile most R Markdown documents.
\
###Installing R Markdown on a University teaching computer
The University computers already have R and RStudio installed with the required R packages (rmarkdown, knitr etc). However, if you want to generate PDF output, you will need to install LaTeX. For R Markdown users who have not installed LaTeX before, we recommend that you install [TinyTeX](https://yihui.name/tinytex/). You can install TinyTex from within R:
```{r, eval = FALSE}
install.packages('tinytex')
tinytex::install_tinytex() # install TinyTeX
```
TinyTeX is a lightweight, portable, cross-platform, and easy-to-maintain LaTeX distribution. The R companion package tinytex can help you automatically install missing LaTeX packages when compiling LaTeX or R Markdown documents to PDF.
With the rmarkdown package, RStudio/Pandoc, and LaTeX, you should be able to compile most R Markdown documents.