install.packages("rmarkdown")
install.packages("knitr")
install.packages("tinytex")
install.packages("here")
install.packages("tidyverse")
install.packages("broom")
install.packages("fs")
install.packages("usethis")
3 Installation
For a scientific report to be completely credible, it must be reproducible. The full computational environment used to derive the results, including the data and code used for statistical analysis should be available for others to reproduce. quarto is a tool that allows you integrate your code, text and figures in a single file in order to make high quality, reproducible reports. A paper published with an included quarto file and data sets can be reproduced by anyone with a computer.
In this section, the aim is to have everyone setup with R, RStudio, and RMarkdown.
3.1 Overview
- Duration 15 minutes
3.2 Questions
- How do I install R?
- How do I install rmarkdown?
- How do I install LaTeX in a sane way?
3.3 Software Setup
3.3.1 R
3.3.1.1 Windows
https://cloud.r-project.org/bin/windows/
3.3.1.2 MacOS
https://cloud.r-project.org/bin/macosx/
3.3.1.3 Linux
https://cloud.r-project.org/bin/linux/
3.3.2 RStudio
https://www.rstudio.com/products/rstudio/download/#download
3.4 RMarkdown
To ensure you are up to date, run the following script to install the packages.
3.5 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 () (pronounced la-tek or lay-tek).
Installing LaTeX can be a pain, but thankfully there is an easier way to install it - tinytex
. tinytex
is an R package that installs a sane, lightweight (<200Mb) version of LaTeX.
::install_tinytex() 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).
3.5.1 Problem solving with LaTeX
If you have any problems with installing tinytex
, I recommend you check out the tinytex FAQ page.
3.6 Test Script
You should be able to run the following code on your machine
library(rmarkdown)
library(knitr)
library(tinytex)
library(here)
library(tidyverse)
library(broom)
library(fs)
library(usethis)