1 Preface

This template is written in R Markdown with bookdown. It is automatically built from source and deployed online using GitHub Actions. The Bookdown Thesis Template is a collaborative effort and fixes and improvements can be contributed via pull request.

1.1 How this template is organized

This template is organized into two main sections: The first being a guide on how to use this template for your own thesis, and the second being an example thesis section to give you an idea of how your thesis can look using this template. You can also check out the source files for this template if you want to see the syntax for anything implemented here.

1.2 Prerequisites

We have made a few assumptions about what you already know in order to get the most out of this template. You should be comfortable using computers, and it’s helpful if you have some R programming experience already. If you’ve never programmed in R before, you might find Hands on Programming with R by Garrett Grolemund and R for Data Science by Garrett Grolemund and Hadley Wickham to be useful companions to this template.

There are four things you need to use this template: R, RStudio, an R package called bookdown, and a handful of other R packages. Packages are the fundamental units of reproducible R code. They include reusable functions, the documentation that describes how to use them, and sample data.

If you want to manage and store revisions of your thesis or publish it to the web, you will also need: A GitHub account and a Netlify account. GitHub is a Git repository hosting service that allows you to manage and store revisions of your project online, control who has access to your project, and collaborate with others. Netlify is a free web-hosting service that integrates with GitHub, allowing you to automatically (or manually) publish your thesis online as its own website.

1.2.1 R

To download R, go to CRAN, the comprehensive R archive network. CRAN is composed of a set of mirror servers distributed around the world and is used to distribute R and R packages. Don’t try and pick a mirror that’s close to you: instead use the cloud mirror, https://cloud.r-project.org, which automatically figures it out for you.

A new major version of R comes out once a year, and there are 2-3 minor releases each year. Because a thesis is a multi-year project, it is likely that new major and minor versions of R will be released in the midst of your thesis. Although it’s a good idea to update regularly (and putting it off only makes it worse), upgrading can be a bit of a hassle, especially for major versions, which require you to reinstall all your packages, and which may require you to change portions of any code you have written.

If upgrading your R version in the midst of your thesis sounds like a nightmare, we recommend you use the renv R package to lock the R version used in your thesis project, whilst allowing you to use newer R versions for other projects. If you find yourself switching R versions frequently and use macOS, you may also find the RSwitch menubar utility useful.

1.2.2 RStudio

RStudio is an integrated development environment, or IDE, for R programming. Download and install it from http://www.rstudio.com/download. RStudio is updated a couple of times a year. When a new version is available, RStudio will let you know. It’s a good idea to upgrade regularly so you can take advantage of the latest and greatest features. For this template, make sure you have at least RStudio 1.0.0.

If you have not used RStudio before, the RStudio IDE Cheatsheet provides a nice overview of the program:

As well as keyboard shortcuts to help improve your productivity:

1.2.3 bookdown

You’ll also need to install some R packages. An R package is a collection of functions, data, and documentation that extends the capabilities of base R. Using packages is key to the successful use of R.

You can install bookdown with a single line of code:

install.packages("bookdown")

On your own computer, type that line of code in the console, and then press enter to run it. R will download the package from CRAN and install it on to your computer. If you have problems installing, make sure that you are connected to the internet, and that https://cloud.r-project.org/ isn’t blocked by your firewall or proxy.

1.2.4 Other packages

There are a few other packages you need to install in order to use this template. First is the tinytex package, which is used when building the PDF version of your book:

install.packages("tinytex")
tinytex::install_tinytex()

Second is the renv package, which is used to create a reproducible environment for your R project:

install.packages("renv")

Third are a handful of packages that are used to generate the acknowledgments and colophon sections at the bottom of this page:

install.packages(c("magrittr", "gh", "tibble", "purrr", "readr", "dplyr"))

1.2.5 GitHub

GitHub is a Git repository hosting service that allows you to manage and store revisions of your project online, control who has access to your project, and collaborate with others. You will need to register an account in order to use GitHub.

1.2.6 Netlify

Netlify is a free web-hosting service that integrates with GitHub, allowing you to automatically (or manually) publish your thesis online as its own website. You will need to register an account in order to use GitHub—you can register using your GitHub account.

1.3 Acknowledgments

A big thank you to everyone who has supported me on this journey.

1.4 Colophon

This template was written in RStudio using bookdown. The online version of this template is available at https://your-url. It is hosted with netlify, and is automatically updated after every commit by GitHub Actions. The complete source is available at https://github.com/mccarthy-m-g/bookdown-thesis-template.

This version of the template was built with R version 3.6.0 (2019-04-26) and the following packages:

package version source
BH 1.72.0-3 CRAN
R6 2.4.1 CRAN
Rcpp 1.0.3 CRAN
askpass 1.1 CRAN
assertthat 0.2.1 CRAN
backports 1.1.9 CRAN
base64enc 0.1-3 CRAN
bayestestR 0.7.5 CRAN
bookdown 0.20 CRAN
broom 0.7.0.9001 NULL
cli 2.0.2 CRAN
clipr 0.7.0 CRAN
cpp11 0.2.1 CRAN
crayon 1.3.4 CRAN
curl 4.3 CRAN
digest 0.6.25 CRAN
dplyr 1.0.2 CRAN
effectsize 0.4.0 CRAN
ellipsis 0.3.1 CRAN
evaluate 0.14 CRAN
fansi 0.4.1 CRAN
generics 0.0.2 CRAN
gh 1.1.0 CRAN
glue 1.4.2 CRAN
highr 0.8 CRAN
hms 0.5.3 CRAN
htmltools 0.5.0 CRAN
httr 1.4.1 CRAN
ini 0.3.1 CRAN
insight 0.10.0 CRAN
jsonlite 1.7.1 CRAN
knitr 1.29 CRAN
lifecycle 0.2.0 CRAN
magrittr 1.5 CRAN
markdown 1.1 CRAN
mime 0.9 CRAN
openssl 1.4.1 CRAN
papaja 0.1.0.9997 NULL
parameters 0.8.6 CRAN
pillar 1.4.6 CRAN
pkgconfig 2.0.3 CRAN
purrr 0.3.4 CRAN
readr 1.3.1 CRAN
renv 0.12.0 CRAN
rlang 0.4.7 CRAN
rmarkdown 2.3 CRAN
rmdfiltr 0.1.2 CRAN
stringi 1.5.3 CRAN
stringr 1.4.0 CRAN
sys 3.3 CRAN
tibble 3.0.3 CRAN
tidyr 1.1.2 CRAN
tidyselect 1.1.0 CRAN
tinytex 0.25 CRAN
utf8 1.1.4 CRAN
vctrs 0.3.4 CRAN
xfun 0.17 CRAN
yaml 2.2.1 CRAN
zip 2.1.1 CRAN