If you want to work through the workshop activities using your own installation of R and RStudio, then you’ll need to have the following packages installed:
– magick
– gganimate
(from github)
– ggimage
– nullabor
– tidyverse
(who knows where our exploring will take us!)
You can install them with:
## gganimate is not on CRAN yet
# install.packages('devtools')
devtools::install_github('thomasp85/gganimate')
## install all the CRAN ones!
all_packages <- c("tidyverse", "magick", "ggimage", "nullabor")
install.packages(all_packages, dependencies=TRUE)
If you would like to check your laptop is all good to go for the workshop, try running the code below :-)
library(magick)
library(gganimate)
library(ggimage)
library(nullabor)
library(tidyverse)
## sample code from magick package
newlogo <- image_scale(image_read("https://jeroen.github.io/images/Rlogo.png"), "x150")
oldlogo <- image_scale(image_read("https://developer.r-project.org/Logo/Rlogo-3.png"), "x150")
frames <- image_morph(c(oldlogo, newlogo), frames = 10)
image_animate(frames)
## sample code from gganimate package
ggplot(mtcars, aes(factor(cyl), mpg)) +
geom_boxplot() +
# Here comes the gganimate code
transition_states(
gear,
transition_length = 2,
state_length = 1
) +
enter_fade() +
exit_shrink() +
ease_aes('sine-in-out')
## sample code from ggimage package
set.seed(2017-02-21)
d <- data.frame(x = rnorm(10), y = rnorm(10),
image = sample(
c("https://www.r-project.org/logo/Rlogo.png",
"https://jeroenooms.github.io/images/frink.png"),
size=10, replace = TRUE)
)
ggplot(d, aes(x, y)) + geom_image(aes(image=image), size=.05)
## sample code from nullabor package
d <- lineup(null_permute("mpg"), mtcars)
ggplot(data = d, aes(x = mpg, y = wt)) + geom_point() + facet_wrap(~ .sample)
We used RStudio Cloud. as a backup. You can run R via RStudio in your browser, set up different workspaces and projects with all the packages you need, and then share with others if needed.