https://github.com/nuest/rockerverse-paper
Scientific paper about everything related to containers and R
https://github.com/nuest/rockerverse-paper
docker r-programming r-project rocker rocker-project rstats
Last synced: 3 months ago
JSON representation
Scientific paper about everything related to containers and R
- Host: GitHub
- URL: https://github.com/nuest/rockerverse-paper
- Owner: nuest
- Created: 2017-10-03T12:41:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-14T12:34:59.000Z (over 4 years ago)
- Last Synced: 2024-12-29T15:01:56.417Z (4 months ago)
- Topics: docker, r-programming, r-project, rocker, rocker-project, rstats
- Language: TeX
- Homepage: https://doi.org/10.32614/RJ-2020-007
- Size: 11.1 MB
- Stars: 23
- Watchers: 17
- Forks: 19
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- jimsghstars - nuest/rockerverse-paper - Scientific paper about everything related to containers and R (TeX)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# Rockerverse
[](https://mybinder.org/v2/gh/nuest/rockerverse-paper/master?urlpath=rstudio)
[](https://travis-ci.org/nuest/rockerverse-paper)Article about everything related to containers and R, originally based on [this blog post](http://bit.ly/docker-r) and now **available as a preprint on arXiv.org: https://arxiv.org/abs/2001.10641** ([read as HTML](https://www.arxiv-vanity.com/papers/2001.10641/)).
**Current draft: https://nuest.github.io/rockerverse-paper/master.pdf**
```{r hexSticker, message=TRUE, warning=FALSE, cache=TRUE, include=FALSE}
library("magick")
library("here")# https://commons.wikimedia.org/wiki/File:NASA-HS201427a-HubbleUltraDeepField2014-20140603.jpg
if(!file.exists("universe.png")) {
universe <- magick::image_read("https://upload.wikimedia.org/wikipedia/commons/6/69/NASA-HS201427a-HubbleUltraDeepField2014-20140603.jpg")
magick::image_write(universe, here("universe.png"))
}magick::image_read("https://avatars2.githubusercontent.com/u/9100160?s=200&v=4") %>%
magick::image_scale("2100x2100") %>%
magick::image_channel("Matte") %>%
image_negate() %>%
magick::image_border("black", "150x0") %>%
magick::image_write(here("rocker_mask.png"))
# does not work: image_composite(universe, rockerLogoMask, operator = "CopyOpacity", compose_args = "-composite -alpha Off")
system2("convert", c(here("universe.png"), here("rocker_mask.png"),
"-alpha Off",
"-compose CopyOpacity",
"-composite",
here("whaleverse.png")))library("sysfonts")
if(!file.exists(here::here("FinalFrontierOldStyle-8Pg.ttf"))) {
stop("Download font Final Frontier Old Style, e.g. from https://www.fontspace.com/allen-r-walden/final-frontier-old-style and put the file in the repo root.")
}
sysfonts::font_add("finalfrontier", here::here("FinalFrontierOldStyle-8Pg.ttf"))library("hexSticker")
factor <- 1 # for print: 4
hexSticker::sticker(here::here("whaleverse.png"), package = "ROCKERVERSE",
p_family = "finalfrontier",
p_size = 29 * factor, p_y = 1.3,
s_x = 0.97, s_y = 0.95, s_width = 1,
h_fill = "#000000", h_color = "#ffffff",
url = "github.com/nuest/rockerverse-paper",
u_color = "#ffffff", u_size = 4 * factor,
filename = here::here(ifelse(
factor == 1,
"rockerverse.png",
paste0("rockerverse_", 300 * factor, "dpi.png"))),
dpi = 300 * factor)#file.remove(c(here("universe.png"), here("whaleverse.png"), here("rocker_mask.png")))
```
The hex sticker uses the font [Final Frontier Old Style](https://www.fontspace.com/allen-r-walden/final-frontier-old-style) and the [Hubble Ultra-Deep Field](https://en.wikipedia.org/wiki/Hubble_Ultra-Deep_Field) combined with the Docker logo as background.
## Render the manuscript with Docker
**Local build**
```bash
docker build --tag rockerverse-paper --file .binder/Dockerfile .
docker run -i -v $(pwd):/rockerverse --user $UID rockerverse-paper Rscript -e 'setwd("/rockerverse"); rmarkdown::render("rockerverse.Rmd")'
```**Image from Docker Hub**
```bash
docker run -i -v $(pwd):/rockerverse --user $UID nuest/rockerverse-paper Rscript -e 'setwd("/rockerverse"); rmarkdown::render("rockerverse.Rmd")'
```## Not included projects and packages
- `rize`, because discontinued, see #35
- `docker` ([https://bhaskarvk.github.io/docker](https://bhaskarvk.github.io/docker) has been removed from CRAN, seems unmaintained by authors
- https://github.com/svlentink/dockerfiles/blob/master/svlentink/r-base-alpine/Dockerfile because the Alpine image is quite a trivial one
- https://github.com/jlisic/R-docker-centos because CentOS images are also provided by R-hub
- `sevenbridges` includes several Dockerfiles and documentation about using images, and also seems to use Docker in the built workflows but via other tools, not directly, https://sbg.github.io/sevenbridges-r/, https://github.com/sbg/sevenbridges-r/search?p=4&q=docker&unscoped_q=docker
- https://github.com/rocker-jp because it seems to have stalled soon after inception
- https://github.com/thomasp85/fiery because no examples/docs for Docker (though probably trivial anyway)
- [RStudio Connect](https://rstudio.com/products/connect/) because while it does use a similar mechanism to seperate processes, it does _not_ use Docker and the comparison would require a lot of background explanation, and not all details are available because the software is proprietary
- https://github.com/ecohealthalliance/reservoir is an invididual specific data science image container for a group - add if it fits
- https://itsalocke.com/blog/building-an-r-training-environment/ (one single container for many users in teaching, uses rocker/tidyverse)## Helpers
The [README.Rmd](README.Rmd) file's source includes some useful little code snippets, e.g. count words or get a list of all contributor's GitHub handles.
```{r word_stats, eval=FALSE, include=FALSE}
# devtools::install_github("benmarwick/wordcountaddin", type = "source", dependencies = TRUE)
wordcountaddin::readability(here::here("rockerverse.Rmd"))
wordcountaddin::text_stats(here::here("rockerverse.Rmd"))
``````{r preprint_pdf, eval=FALSE, include=FALSE}
# run this chunk, get the PDF, then revert changes in touched files
library("rmarkdown")
library("rticles")
unlink('manuscript_cache', recursive = TRUE)# function is a copy of rticles::rjournal_article() but...
# - using RJWrapper_preprint_template.tex (which includes header.tex commands)
# - directly referencing unexported functions from rticles
# - direclty setting the keep_tex option
rjournal_style_preprint <- function (..., citation_package = "natbib") {
rmarkdown::pandoc_available("2.2", TRUE)
base <- rticles:::pdf_document_format("rjournal_article", highlight = NULL,
citation_package = citation_package, ...)
base$pandoc$to <- "latex"
base$pandoc$ext <- ".tex"
base$pandoc$keep_tex <- TRUE # added
base$post_processor <- function(metadata, utf8_input, output_file,
clean, verbose) {
filename <- basename(output_file)
if (filename != (filename2 <- gsub("_", "-", filename))) {
file.rename(filename, filename2)
filename <- filename2
}
m <- list(filename = xfun::sans_ext(filename))
h <- rticles:::get_list_element(metadata, c("output", "rticles::rjournal_article",
"includes", "in_header"))
h <- c(h, if (length(preamble <- unlist(metadata[c("preamble",
"header-includes")]))) {
f <- tempfile(fileext = ".tex")
on.exit(unlink(f), add = TRUE)
xfun::write_utf8(preamble, f)
f
})
#t <- find_resource("rjournal_article", "RJwrapper.tex")
t <- here::here("RJwrapper_preprint_template.tex")
rticles:::template_pandoc(m, t, "RJwrapper.tex", h, verbose)
tinytex::latexmk("RJwrapper.tex", base$pandoc$latex_engine,
clean = clean)
}
base$knitr$opts_chunk$comment <- "#>"
hilight_source <- rticles:::knitr_fun("hilight_source")
hook_chunk = function(x, options) {
if (rticles:::output_asis(x, options))
return(x)
paste0("```{=latex}\n\\begin{Schunk}\n", x, "\\end{Schunk}\n```")
}
hook_input <- function(x, options) paste(c("\\begin{Sinput}",
hilight_source(x, "sweave", options), "\\end{Sinput}",
""), collapse = "\n")
hook_output <- function(x, options) paste("\\begin{Soutput}\n",
x, "\\end{Soutput}\n", sep = "")
base$knitr$knit_hooks <- rticles:::merge_list(base$knitr$knit_hooks,
list(chunk = hook_chunk, source = hook_input, output = hook_output,
message = hook_output, warning = hook_output, plot = knitr::hook_plot_tex))
base
}rmarkdown::render("rockerverse.Rmd", output_format = rjournal_style_preprint())
file.rename("RJwrapper.pdf", "rockerverse-preprint.pdf") # file for own archival# For submission to arXiv:
# 1. Copy the following files into a new folder:
# - figures/*
# - rockerverse.tex
# - RJournal.sty
# - rockerverse.bib
# - RJwrapper.tex
# 2. Run pdfLaTeX directly on RJwrapper.tex (works with RStudio)
# 3. Zip the following files and submit to arXiv:
# - /figures
# - rockerverse.tex
# - RJournal.sty
# - RJwrapper.bbl
# - RJwrapper.tex
``````{r collab_emails, eval=FALSE, include=FALSE}
front_matter <- rmarkdown::yaml_front_matter("rockerverse.Rmd")
emails <- sapply(X = front_matter$author, FUN = function(a) { a$email })
cat(emails, sep = "\n")
``````{bash collab_handles, eval=FALSE, include=FALSE}
cat rockerverse.Rmd | grep ' # https://github.com/' | sed 's| # https://github.com/|@|'
``````{r submission_zipfile, eval=FALSE, include=FALSE}
# Please upload a zip file of the directory containing a motivating letter (in PDF format) if required, the sources of your article; the *.tex, *.bib and *.R files should have the same file name before the extension, which should be your last or family name in lower-case letters, or the last or family names of the authors joined using hyphens. Your title should not include dashes or hyphens. Make sure to also include RJwrapper.tex and RJwrapper.pdf.
zip::zip("rockerverse.zip", c("rockerverse.tex",
"rockerverse.bib",
"rockerverse.R",
"figures/orcid.pdf",
"figures/Rlogo.pdf",
"RJwrapper.tex",
"RJwrapper.pdf"))
```