Skip to content

Setting Docker environment for the Graphic Design with ggplot2 workshop at RStudio conf 2022

Notifications You must be signed in to change notification settings

RamiKrispin/rstudio-conf-ggplot2-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Docker environment for the Graphic Design with ggplot2 workshop

This repo provides Docker environment for the Graphic Design with ggplot2 workshop at rstudio::conf 2022 by Cédric Scherer.

Current image: rkrispin/ggplot2_workshop:dev.0.0.0.9000

Getting started

The Docker image named as rkrispin/ggplot2_workshop:dev.0.0.0.9000, you can pull it with the docker pull command:

docker pull rkrispin/ggplot2_workshop:dev.0.0.0.9000

And run it with:

docker run -d -p 8787:8787 rkrispin/ggplot2_workshop:dev.0.0.0.9000 

To confirm that the docker is running you can use the docker ps command. You should expect the following output:

docker ps                                                                      
CONTAINER ID   IMAGE                                      COMMAND                  CREATED         STATUS         PORTS                    NAMES
6168ec1ddd95   rkrispin/ggplot2_workshop:dev.0.0.0.9000   "/usr/lib/rstudio-se…"   9 seconds ago   Up 8 seconds   0.0.0.0:8787->8787/tcp   determined_hypatia

You can now open RStudio server from your browser by logging to http://localhost:8787:

Using docker-compose

A more robust way to work with RStudio server is to lunch the image with docker-compose. This enables to add some customiztion, which can done also from the command line but simpler with docker-compose. To load your RStudio local setting and month the docker container to a local folder we will have to set the following envrionment variables:

  • GGPLOT2_WORKSHOP_IMAGE - the name of the image
  • GGPLOT2_WORKING_WORKING_DIR - the path of the local folder to MONTH with the docker container
  • RSTUDIO_CONFIG_PATH - The path for your local RStudio setting to load your setting (color theme, code snippet, etc.)

To lunch RStudio server with docker compose use the docker-compose command:

docker-compose up -d

You should expect the following output:

Check the environment requirements

To test and validate that all the required packages are install in the container, once lunched, run the following code:

packages <- c(
  "ggplot2", "readr", "tibble", "tidyr", "forcats", "stringr",
  "lubridate", "here", "systemfonts", "magick", "scales", "grid",
  "grDevices", "colorspace", "viridis", "RColorBrewer", "rcartocolor",
  "scico", "ggsci", "ggthemes", "nord", "MetBrewer", "ggrepel",
  "ggforce", "ggtext", "ggdist", "ggbeeswarm", "gghalves", "patchwork", 
  "palmerpenguins", "rnaturalearth", "sf", "rmapshaper", "devtools",
  "cowplot", "colorblindr")

installed_packages <- rownames(installed.packages())
f <- FALSE
for(i in sort(packages)){
    if(!i %in% installed_packages){
      f <- TRUE
      cat("\033[0;91m",i, "...Fail", "\033[0m\n")
    } else{
      cat("\033[0;92m",i, "...OK", "\033[0m\n")
    }
}

TODO

  • Run docker with log
  • Debug missing packages
  • Fix the mov file
  • Update the docker version
  • Check spelling

About

Setting Docker environment for the Graphic Design with ggplot2 workshop at RStudio conf 2022

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published