For this workshop, you’ll need to install several R packages. This page will guide you through installing the packages we will use. If you are comfortable installing packages in R, then you could run this code from your R console to install all of the necessary packages:
arm_from_cran <- c("flexdashboard", "learnr", "bookdown",
"officer", "rticles", "webshot",
"tidyverse", "remotes", "babynames", "magick")
install.packages(arm_from_cran, dependencies = TRUE)
arm_from_gh <- c('yihui/xaringan', 'rstudio/blogdown',
'rstudio-education/armcompanion',
'haozhu233/kableExtra', 'apreshill/bakeoff',
'hebrewseniorlife/memor')
remotes::install_github(arm_from_gh, dependencies = TRUE)
webshot::install_phantomjs()
- Also please review section 0.5.2 to make sure you have Hugo version 0.52, which you’ll need for blogdown.
- Please review section 0.9.1 to install
phantom_js
Download script
Click here to download an R script for installing all the necessary packages.
xaringan
Install the xaringan package from GitHub as follows:
remotes::install_github('yihui/xaringan', dependencies = TRUE)
Can you load the package?
# should just work if installed
library(xaringan)
You can also check to make sure an individual package is installed by running this function (see Section 0.14 for how to check for all packages):
is_installed <- function(pkg_name){
setNames(is.element(pkg_name, installed.packages()[, "Package"]), pkg_name)
}
is_installed("xaringan")
# xaringan
# TRUE
Does this code return TRUE
?
flexdashboard
Install the flexdashboard package from CRAN as follows:
install.packages("flexdashboard", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(flexdashboard)
Does this code return TRUE
?
is_installed("flexdashboard")
# flexdashboard
# TRUE
learnr
Install the learnr package from CRAN as follows:
install.packages("learnr", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(learnr)
Does this code return TRUE
?
is_installed("learnr")
# learnr
# TRUE
blogdown
Install the blogdown package from GitHub as follows:
remotes::install_github('rstudio/blogdown', dependencies = TRUE)
Can you load the package?
# should just work if installed
library(blogdown)
Does this code return TRUE
?
is_installed("blogdown")
# blogdown
# TRUE
Install Hugo
Hugo (https://gohugo.io) is the static site generator on which blogdown is based. You must install Hugo in order to build a site using the blogdown package. You may install Hugo using the blogdown package helper function in your R Console:
blogdown::install_hugo()
Update Hugo (if necessary)
In your R Console, please do the following to make sure that you are working with the latest version of Hugo (>= 0.52):
blogdown::hugo_version() # to check your version
blogdown::update_hugo() # to force an update
bookdown
Install the bookdown package from CRAN as follows:
install.packages("bookdown", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(bookdown)
Does this code return TRUE
?
is_installed("bookdown")
# bookdown
# TRUE
officer
Install the officer package from CRAN as follows:
install.packages("officer", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(officer)
Does this code return TRUE
?
is_installed("officer")
# officer
# TRUE
rticles
Install the rticles package from CRAN as follows:
install.packages("rticles", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(rticles)
Does this code return TRUE
?
is_installed("rticles")
# rticles
# TRUE
kableExtra
Install the kableExtra package from GitHub as follows:
remotes::install_packages("haozhu233/kableExtra", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(kableExtra)
Does this code return TRUE
?
is_installed("kableExtra")
# kableExtra
# TRUE
webshot
To be able to save HTML table as images (kableExtra::save_kable()
):
install.packages("webshot", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(webshot)
Does this code return TRUE
?
is_installed("webshot")
# webshot
# TRUE
Please also do the following:
webshot::install_phantomjs()
magick
To be able to save PDF table as images (kableExtra::save_kable()
):
install.packages("magick", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(magick)
Does this code return TRUE
?
is_installed("magick")
# magick
# TRUE
memor
Install the memor package from GitHub as follows:
remotes::install_packages("hebrewseniorlife/memor", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(memor)
Does this code return TRUE
?
is_installed("memor")
# memor
# TRUE
tidyverse & data packages
For many code examples provided in the workshop activities, you’ll need to install the tidyverse meta-package and some data packages from CRAN as follows:
install.packages(c("tidyverse", "babynames"), dependencies = TRUE)
Can you load the packages?
# should just work if installed
library(tidyverse)
library(babynames)
Does this code return TRUE
?
is_installed(c("tidyverse", "babynames"))
# tidyverse babynames
# TRUE TRUE
armcompanion
You can download our workshop companion package from the RStudio Education GitHub:
remotes::install_github("rstudio-education/armcompanion", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(armcompanion)
Does this code return TRUE
?
is_installed("armcompanion")
# armcompanion
# TRUE
bakeoff
You can download our workshop companion package from GitHub:
remotes::install_github("apreshill/bakeoff", dependencies = TRUE)
Can you load the package?
# should just work if installed
library(bakeoff)
Does this code return TRUE
?
is_installed("bakeoff")
# bakeoff
# TRUE
Check all package installs
is_installed(c(arm_from_cran, 'xaringan', 'blogdown', 'armcompanion', 'kableExtra', 'bakeoff'))
# flexdashboard learnr bookdown officer rticles
# TRUE TRUE TRUE TRUE TRUE
# webshot tidyverse remotes babynames magick
# TRUE TRUE TRUE TRUE TRUE
# xaringan blogdown armcompanion kableExtra bakeoff
# TRUE TRUE TRUE TRUE TRUE