Sign inSign up

kamermanpr/docker-spars

By kamermanpr

Updated almost 8 years ago

Image of the R environment required to run the SPARS data analysis scripts.

Image
0

346

kamermanpr/docker-spars repository overview

docker-spars

A dockerfile to create an image of the R environment required to run the SPARS data analysis scripts (kamermanpr/SPARS).


R environment

The image is built using the rocker/verse image of base R v3.5.1, and includes RStudio server, the TinyTex Latex distribution, the tidyverse suite of R packages (with dependencies), and several R packages (with dependencies) that are required to run the markdown scripts in SPARS. CRAN packages were installed from MRAN using the 2018-10-03 snapshot for R v3.5.1. The only package installed from GitHub (thomasp85/patchwork) was locked to the 22 September 2018 commit: fd7958bae3e7a1e30237c751952e412a0a1d1242.

Details
  • OS:
    • Debian:stretch
  • R:
    • v3.5.1
  • RStudio server:
    • v1.1.456
  • GitHub packages:
    • patchwork
  • MRAN packages:
    • boot
    • car
    • kableExtra
    • ggplot2
    • ggridges
    • ggeffects
    • HLMdiag
    • influence.ME
    • lme4
    • lmerTest
    • lqmm
    • robustlmm
    • sjPlot
    • tidyverse
  • LaTex:
    • TinyTex

Using Docker to run the SPARS analysis

These instructions are for running the analysis on your local machine.

You need to have Docker installed on your computer. To do so, go to docker.com and follow the instructions for downloading and installing Docker for your operating system. Once Docker has been installed, follow the steps below, noting that Docker commands are entered in a terminal window (Linux and OSX/macOS) or command prompt window (Windows). Windows users also may wish to install GNU Make (required for the make method of running the scripts) and Git version control software (not essential).

Download the latest image

Enter: docker pull kamermanpr/docker-spars:v1.1.2

Download the repository

Download the compressed zip file from GitHub (kamermanpr/SPARS, or from figshare (DOI: 10.6084/m9.figshare.6561743).

Run the container

Enter: docker run --name spars -d -p 8787:8787 -e USER=user -e PASSWORD=password kamermanpr/docker-spars:v1.1.2

Login to RStudio Server
  • Open a web browser window and navigate to: localhost:8787

  • Use the following login credentials:

    • Username: user
    • Password: password
Prepare the SPARS directory

On the Files tab in the bottom right panel of RStudio, click on the 'Upload' button, navigate to the downloaded zip file, and upload the file (it will self extract).

The SPARS directory comes with the outputs for all the analysis scripts in the /outputs directory (html and md formats). However, should you wish to run the scripts yourself, there are several preparatory steps that are required:

  1. Acquire the data. The data required to run the scripts have not been included in the repo because participants in the studies did not consent to public release of their data. However, the data are available on request from Tory Madden ([email protected]) or Peter Kamerman ([email protected]). We will send you a zip file with the data.

    Using the directory tree in the Files tab of RStudio, open the SPARS directory. Repeat the upload procedure described above, but upload the zipped data file we supplied you with into the SPARS directory.

  2. In the SPARS directory, double-click on the SPARS.Rproj file, and follow the prompts (RStudio with reload).

  3. Clean the /outputs and /figures directories by entering make clean in the Terminal tab in bottom right panel of RStudio.

Run the SPARS analysis scripts

To run all the scripts (including the data cleaning scripts), enter make in the Terminal tab.

To run individual RMarkdown scripts (*.Rmd files)

  1. Generate the cleaned data using one of the following methods:
    • Enter make data-cleaned/SPARS_A.rds and then make data-cleaned/SPARS_B.rds in the Terminal tab;
    • Enter source('0A-clean-data.R') and then source('0B-clean-data.R') in the Console tab in bottom left panel of RStudio.
    • Open 0A-clean-data.R and 0B-clean-data.R scripts through the File tab, and then click the 'Source' button on top of the panel on the top left of RStudio for each script.
  2. Run the individual script using one of the following methods:
    • Enter make outputs/<NAME_OF_INPUT_FILE>.html in the Terminal tab;
    • Open the relevant *.Rmd file through the File tab, and then click the 'knit' button on the top of the panel on the top left of RStudio.
Shutting down

Once done, log out of RStudio and enter the following into a terminal to stop the Docker container: docker stop spars. If you then want to remove the container, enter: docker rm spars. If you also want to remove the Docker image you downloaded, enter: docker rmi kamermanpr/docker-spars:v1.1.2

Tag summary

Content type

Image

Digest

Size

988.9 MB

Last updated

almost 8 years ago

docker pull kamermanpr/docker-spars:v1.1.2