A The First Appendix
This first appendix includes all of the R chunks of code that were hidden throughout the document (using the include = FALSE
chunk tag) to help with readibility and/or setup.
In the main Rmd file
# This chunk ensures that the thesisdown package is
# installed and loaded. This thesisdown package includes
# the template files for the thesis.
if (!require(remotes)) {
if (params$`Install needed packages for {thesisdown}`) {
install.packages("remotes", repos = "https://cran.rstudio.com")
} else {
stop(
paste('You need to run install.packages("remotes")",
"first in the Console.')
)
}
}
if (!require(thesisdown)) {
if (params$`Install needed packages for {thesisdown}`) {
remotes::install_github("ismayc/thesisdown")
} else {
stop(
paste(
"You need to run",
'remotes::install_github("ismayc/thesisdown")',
"first in the Console."
)
)
}
}
library(thesisdown)
# Set how wide the R output will go
options(width = 70)
In Chapter 3:
# This chunk ensures that the thesisdown package is
# installed and loaded. This thesisdown package includes
# the template files for the thesis and also two functions
# used for labeling and referencing
if (!require(remotes)) {
if (params$`Install needed packages for {thesisdown}`) {
install.packages("remotes", repos = "https://cran.rstudio.com")
} else {
stop(
paste(
'You need to run install.packages("remotes")',
"first in the Console."
)
)
}
}
if (!require(dplyr)) {
if (params$`Install needed packages for {thesisdown}`) {
install.packages("dplyr", repos = "https://cran.rstudio.com")
} else {
stop(
paste(
'You need to run install.packages("dplyr")',
"first in the Console."
)
)
}
}
if (!require(ggplot2)) {
if (params$`Install needed packages for {thesisdown}`) {
install.packages("ggplot2", repos = "https://cran.rstudio.com")
} else {
stop(
paste(
'You need to run install.packages("ggplot2")',
"first in the Console."
)
)
}
}
if (!require(bookdown)) {
if (params$`Install needed packages for {thesisdown}`) {
install.packages("bookdown", repos = "https://cran.rstudio.com")
} else {
stop(
paste(
'You need to run install.packages("bookdown")',
"first in the Console."
)
)
}
}
if (!require(thesisdown)) {
if (params$`Install needed packages for {thesisdown}`) {
remotes::install_github("ismayc/thesisdown")
} else {
stop(
paste(
"You need to run",
'remotes::install_github("ismayc/thesisdown")',
"first in the Console."
)
)
}
}
library(thesisdown)
library(dplyr)
library(ggplot2)
library(knitr)
flights <- read.csv("data/flights.csv", stringsAsFactors = FALSE)