Sign inSign up

kamermanpr/docker-survey

By kamermanpr

Updated over 7 years ago

Creates an image of the R environment I find useful when analysing surveys with complex designs.

Image
0

361

kamermanpr/docker-survey repository overview

docker-survey

A dockerfile to create an image of an R environment based on R v3.6.0 that I find useful for analysing surveys with complex designs.


R environment

The image is built using the rocker/geospatial image. The geospatial image adds geospatial-related tools, and builds sequentially on the following images:

ImageDescription
rocker/r-ver:3.6.0Base R v3.6.0 on Debian:stretch
rocker/rstudioAdds RStudio
rocker/tidyverseAdds tidyverse and devtool
rocker/verseAdds tex & publishing-related packages

In addition, the image includes R packages that I find useful when analysing and plotting complex survey data.

These packages include:

  • fiftystater (maps of the 50 US states)
  • geofacet (adds geofaceting functionality to ggplot2)
  • ggiraph (adds interactive geoms to ggplot2)
  • skimr (generates quick tabular data summaries)
  • survey (required for the analysis of complex survey designs)
  • srvyr (a wrapper for survey that gives dplyr-like functionality).

MRAN Snapshot date:

  • The snapshot at the time of the last docker build.

Usage

Local machine
  • Install Docker on your machine (Docker Desktop)

  • Open a terminal and run the following commands:

    # Pull the docker image (you only need to do this once)
    $ docker pull kamermanpr/docker-survey:v2.0.0
    
    # Run the container locally
    $ docker run --name rstudio_survey -d -p 8787:8787 -e USER=rstudio -e PASSWORD=rstudio -e ROOT=TRUE -e kamermanpr/docker-survey:v2.0.0
    

    The default options are:

    • --name rstudio_survey

    • -e USER=rstudio

    • -e PASSWORD=rstudio

    • -e ROOT=TRUE

    Change these options to what works for you, or delete an option all together if you don't need it.

    After the container is up and running, open your browser and enter the following URL: localhost:8787, which will take you to the RStudio Server login page. Use the username/password you set (or: rstudio/rstudio) to login and start analysing.

Cloud
DigitalOcean droplet
  • Login (or create and login) to your DigitalOcean account.

  • Create a new droplet, selecting the 'Docker...' image from the selection of 'One-click apps'.

  • Provision the droplet as you see fit, but check the 'User data' option under the 'Select additional options' section.

  • Enter the following in the textbox that opens:

    #cloud-config
    
    runcmd:
      - docker pull kamermanpr/docker-survey:v2.0.0
      - docker run --name rstudio_survey -d -p 8787:8787 -e USER=rstudio -e PASSWORD=rstudio -e ROOT=TRUE -e kamermanpr/docker-survey:v0.1.4
    

    See the default options in the Local machine section above.

  • Create the droplet, let it launch, and then wait a minute or two while the docker image is pulled and the container launched.

  • Copy the IP address for the droplet you created, and paste it into your browser as follows: <IP ADDRESS>:8787. This will take you to the RStudio Server login page. Use the username/password you set (or: rstudio/rstudio) to login and start analysing.

Amazon EC2 instance
  • Login (or create and login) to your AWS account.

  • Launch a new Ubuntu EC2 instance and provision it as you see fit, but under the the 'Configure Security Group' step, include an 'SSH', 'HTTP' (source: Anywhere 0.0.0.0/0, ::/0) and 'HTTPS' (source: Anywhere 0.0.0.0/0, ::/0) protocols. In the final pop-up window when launching, choose an existing SSH key-pair or create a new pair.

  • Once the instance is running, copy the 'Public DNS(IPv4)', open a terminal and SSH into the instance using the copied address:

    $ ssh -i <path to pem file> ubuntu@<Public DNS>  
    
  • Pull the docker image and run the container as follows:

    # Pull the docker image (you only need to do this once)
    $ sudo docker pull kamermanpr/docker-survey:v2.0.0
    
    # Run the container
    $ sudo docker run --name rstudio_survey -d -p 8787:8787 -e USER=rstudio -e PASSWORD=rstudio -e ROOT=TRUE -e kamermanpr/docker-survey:v2.0.0
    

    See the default options in the Local machine section above.

  • Copy the 'Public DNS(IPv4)' for the instance, and paste it into your browser as follows: <Public DNS>:8787. This will take you to the RStudio Server login page. Use the username/password you set (or: rstudio/rstudio) to login and start analysing.

Issues

If something doesn't work or you want to suggest additional packages, please open and issue.

Tag summary

Content type

Image

Digest

Size

1.5 GB

Last updated

over 7 years ago

docker pull kamermanpr/docker-survey:v2.0.0