Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.6%) to scientific vocabulary
Keywords
cran
r
reproducibility
reproducible-research
rstats
Last synced: 6 months ago
·
JSON representation
·
Repository
🐶 (Re)constructing R computational environments
Basic Info
- Host: GitHub
- Owner: gesistsa
- License: gpl-3.0
- Language: R
- Default Branch: v0.3
- Homepage: https://gesistsa.github.io/rang/
- Size: 16.7 MB
Statistics
- Stars: 81
- Watchers: 6
- Forks: 4
- Open Issues: 16
- Releases: 4
Topics
cran
r
reproducibility
reproducible-research
rstats
Created about 3 years ago
· Last pushed 6 months ago
Metadata Files
Readme
License
Citation
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rang
[](https://github.com/gesistsa/rang/actions/workflows/R-CMD-check.yaml)
The goal of rang (Reconstructing Ancient Number-crunching Gears) [^gesis] is to obtain the dependency graph of R packages at a specific time point.
Although this package can also be used to ensure the current R computational environment can be reconstructed by future researchers, this package gears towards reconstructing historical R computational environments which have not been completely declared. For the former purpose, packages such as [renv](https://github.com/rstudio/renv/), [groundhog](https://github.com/CredibilityLab/groundhog), [miniCRAN](https://github.com/andrie/miniCRAN), and [Require](https://github.com/PredictiveEcology/Require) should be used. One can think of rang as an archaeological tool.
To reconstruct a historical R computational environment, this package assumes only the availability of source packages online. The reconstruction procedures have been tested in several vintage versions of R.
Please cite this package as:
Chan CH, Schoch D (2023) rang: Reconstructing reproducible R computational environments. PLOS ONE [https://doi.org/10.1371/journal.pone.0286761](https://doi.org/10.1371/journal.pone.0286761)
## Installation
You can install the development version of rang like so:
``` r
remotes::install_github("gesistsa/rang")
```
Or the stable CRAN version
```r
install.packages("rang")
```
## Example
To obtain the dependency graph of R packages, use `resolve`. Currently, this package supports CRAN, Bioconductor, GitHub, and local packages.
```r
library(rang)
x <- resolve(pkgs = c("sna", "schochastics/rtoot", "S4Vectors"), snapshot_date = "2022-11-30")
```
```r
graph <- resolve(pkgs = c("openNLP", "LDAvis", "topicmodels", "quanteda"),
snapshot_date = "2020-01-16")
```
```{r, include = FALSE}
devtools::load_all()
graph <- readRDS("tests/testdata/graph.RDS")
```
```{r example1}
graph
```
```{r example2}
graph$sysreqs
```
```{r example 3}
graph$r_version
```
The resolved result is an S3 object called `rang` and can be exported as an installation script. The installation script can be execute on a vanilla R installation.
```r
export_rang(graph, "rang.R")
```
However, the execution of the installation script often fails (now) due to missing system dependencies and incompatible R versions. Therefore, the approach outlined below should be used.
## Recreate the computational environment via Rocker
A `rang` object can be used to recreate the computational environment via [Rocker](https://github.com/rocker-org/rocker). Please note that the oldest R version one can get from Rocker is R 3.1.0.
```r
dockerize(graph, "~/rocker_test")
```
Now, you can build and run the Docker container.
```bash
cd ~/rocker_test
docker build -t rang .
docker run --rm --name "rangtest" -ti rang
```
Using the above example, `sessionInfo()` outputs the following. You have successfully gone back to the pre-pandemic time.
```
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)
Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] topicmodels_0.2-9 LDAvis_0.3.2 openNLP_0.2-7 quanteda_1.5.2
loaded via a namespace (and not attached):
[1] NLP_0.2-0 Rcpp_1.0.3 pillar_1.4.3
[4] compiler_3.6.2 tools_3.6.2 stopwords_1.0
[7] lubridate_1.7.4 lifecycle_0.1.0 tibble_2.1.3
[10] gtable_0.3.0 lattice_0.20-38 pkgconfig_2.0.3
[13] rlang_0.4.2 Matrix_1.2-18 fastmatch_1.1-0
[16] parallel_3.6.2 openNLPdata_1.5.3-4 rJava_0.9-11
[19] xml2_1.2.2 stringr_1.4.0 stats4_3.6.2
[22] grid_3.6.2 data.table_1.12.8 R6_2.4.1
[25] ggplot2_3.2.1 spacyr_1.2 magrittr_1.5
[28] scales_1.1.0 modeltools_0.2-22 colorspace_1.4-1
[31] stringi_1.4.5 RcppParallel_4.4.4 lazyeval_0.2.2
[34] munsell_0.5.0 tm_0.7-7 slam_0.1-47
[37] crayon_1.3.4
```
### Caching R packages
One can also cache (or archive) the R packages from CRAN and Github at the time `dockerize` is executed. The cached R packages will then transfer to the container. Please note that system requirements (i.e. `deb` packages) are not cached.
```r
dockerize(graph, "~/rocker_test", cache = TRUE)
```
### Using alternative Rocker images
One can also select other Rocker versioned images: `rstudio`, `tidyverse`, `verse`, `geospatial`.
```r
dockerize(graph, "~/rocker_test", image = "rstudio")
```
`tidyverse`, `verse`, and `geospatial` are similar to the default (`r-ver`). For `rstudio`, one needs to build and launch it with:
```bash
cd ~/rocker_test
docker build -t rang .
docker run -p 8787:8787 -e PASSWORD=abc123 --rm --name "rangtest" -ti rang
```
With any browser, go to: `local:8787`. The default username is `rstudio`, password is as specified.
### Using Apptainer/Singularity containers
A `rang` object can be used to recreate the computational environment via [Rocker](https://github.com/rocker-org/rocker). Instead of Docker you can also use [Apptainer/Singularity](https://apptainer.org/). Please note that the oldest R version one can get from Rocker is R 3.1.0.
```r
apptainerize(graph, "~/rocker_test")
# singularize(graph, "~/rocker_test") # same function, as so far Apptainer is identical to Singularity
```
Now, you can build and run the Apptainer/Singularity container.
For Apptainer installation:
```bash
cd ~/rocker_test
apptainer build container.sif container.def
apptainer run container.sif R
```
For Singularity installation:
```bash
cd ~/rocker_test
sudo singularity build container.sif container.def
singularity run container.sif R
```
Using the above example, `sessionInfo()` outputs the following. You have successfully gone back to the pre-pandemic.
```
R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)
Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.3.5.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.2
```
`apptainerize()`/`singularize()` functions work exactly the same as `dockerize()`, except you cannot cache Linux distribution rootfs.
### Apptainer/Singularity with RStudio IDE
To run RStudio IDE in Apptainer/Singularity container, some writeable folders and a config file have to be created locally:
```bash
mkdir -p run var-lib-rstudio-server .rstudio
printf 'provider=sqlite\ndirectory=/var/lib/rstudio-server\n' > database.conf
```
After that, you can run the container (do not run as `root` user, otherwise you will not be able to login to RStudio IDE).
Start instance (on default RSTUDIO port 8787):
```bash
apptainer instance start \
--bind run:/run,var-lib-rstudio-server:/var/lib/rstudio-server,database.conf:/etc/rstudio/database.conf,.rstudio:/home/rstudio/.rstudio/ \
container.sif \
rangtest
```
Now open a browser and go to localhost:8787.
The default username is your local username, default password is 'set_your_password' (if you are using container generated by rang).
List running instances:
```bash
apptainer instance list
```
Stop instance:
```bash
apptainer instance stop rangtest
```
Start instance with custom port (e.g. 8080) and password:
```bash
apptainer instance start \
--env RPORT=8080
--env PASSWORD='set_your_password' \
--bind run:/run,var-lib-rstudio-server:/var/lib/rstudio-server,database.conf:/etc/rstudio/database.conf,.rstudio:/home/rstudio/.rstudio/ \
container.sif \
rangtest
```
Run container with custom `rserver` command line:
```bash
apptainer exec \
--env PASSWORD='set_your_password' \
--bind run:/run,var-lib-rstudio-server:/var/lib/rstudio-server,database.conf:/etc/rstudio/database.conf,.rstudio:/home/rstudio/.rstudio/ \
container.sif \
/usr/lib/rstudio-server/bin/rserver \
--auth-none=0 --auth-pam-helper-path=pam-helper \
--server-user=$(whoami) --www-port=8787
```
If you run the container using `apptainer exec` command, you will have to kill the `rserver` process manually or Cmd/Ctrl+C from the running container to stop the server.
## Recreate the computational environment for R < 3.1.0
`rang` can still be used to recreate computational environments for R < 3.1.0. The Dockerfile generated is based on Debian Lenny (5.0) and the requested version of R is compiled from source. As of writing, this method works for R < 3.1.0 but not R < 1.3.1. The `image` parameter is ignored in this case.
```r
rang_rio <- resolve("rio", snapshot_date = "2013-08-30") ## R 3.0.1
dockerize(rang_rio, output_dir = "~/old_renviron")
```
## `evercran` support (experimental)
`rang` supports [evercran](https://github.com/r-hub/evercran). As of writing, the support is still experimental (just like `evercran` itself). In the future, `evercran` will replace the Debian method.
```r
rang_rio <- resolve("rio", snapshot_date = "2013-08-30") ## R 3.0.1
dockerize(rang_rio, output_dir = "~/old_renviron", method = "evercran")
```
## Acknowledgment
The logo of rang is a remix of [this](https://commons.wikimedia.org/wiki/File:Flag_of_the_Canary_Islands.svg) public domain image. The two dogs should be *Presa Canario*, the native dog breed on the islands of Gran Canaria and Tenerife.
---
[^gesis]: It stands for "R Archiving Nerds at GESIS". The package was previously named `gran`, but we decided to rename it to `rang` because there is another package named [gRAN](https://CRAN.R-project.org/package=GRANBase).
Owner
- Name: Transparent Social Analytics
- Login: gesistsa
- Kind: organization
- Location: Germany
- Repositories: 2
- Profile: https://github.com/gesistsa
Open Science Tools maintained by Transparent Social Analytics Team, GESIS
Citation (CITATION.cff)
# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
cff-version: 1.2.0
message: 'To cite package "rang" in publications use:'
type: software
license: GPL-3.0-or-later
title: 'rang: Reconstructing Reproducible R Computational Environments'
version: 0.3.0
doi: 10.1371/journal.pone.0286761
identifiers:
- type: doi
value: 10.32614/CRAN.package.rang
abstract: Resolve the dependency graph of R packages at a specific time point based
on the information from various 'R-hub' web services <https://blog.r-hub.io/>. The
dependency graph can then be used to reconstruct the R computational environment
with 'Rocker' <https://rocker-project.org>.
authors:
- family-names: Chan
given-names: Chung-hong
email: chainsawtiney@gmail.com
orcid: https://orcid.org/0000-0002-6232-7530
- family-names: Schoch
given-names: David
email: david@schochastics.net
orcid: https://orcid.org/0000-0003-2952-4812
preferred-citation:
type: article
title: 'rang: Reconstructing reproducible R computational environments'
authors:
- family-names: Chan
given-names: Chung-hong
email: chainsawtiney@gmail.com
orcid: https://orcid.org/0000-0002-6232-7530
- family-names: Schoch
given-names: David
email: david@schochastics.net
orcid: https://orcid.org/0000-0003-2952-4812
journal: PLOS ONE
url: https://github.com/gesistsa/rang
year: '2023'
doi: 10.1371/journal.pone.0286761
repository: https://CRAN.R-project.org/package=rang
repository-code: https://github.com/gesistsa/rang
url: https://gesistsa.github.io/rang
contact:
- family-names: Chan
given-names: Chung-hong
email: chainsawtiney@gmail.com
orcid: https://orcid.org/0000-0002-6232-7530
keywords:
- cran
- r
- reproducibility
- reproducible-research
- rstats
references:
- type: software
title: knitr
abstract: 'knitr: A General-Purpose Package for Dynamic Report Generation in R'
notes: Suggests
url: https://yihui.org/knitr/
repository: https://CRAN.R-project.org/package=knitr
authors:
- family-names: Xie
given-names: Yihui
email: xie@yihui.name
orcid: https://orcid.org/0000-0003-0645-5666
year: '2025'
doi: 10.32614/CRAN.package.knitr
- type: software
title: rmarkdown
abstract: 'rmarkdown: Dynamic Documents for R'
notes: Suggests
url: https://pkgs.rstudio.com/rmarkdown/
repository: https://CRAN.R-project.org/package=rmarkdown
authors:
- family-names: Allaire
given-names: JJ
email: jj@posit.co
- family-names: Xie
given-names: Yihui
email: xie@yihui.name
orcid: https://orcid.org/0000-0003-0645-5666
- family-names: Dervieux
given-names: Christophe
email: cderv@posit.co
orcid: https://orcid.org/0000-0003-4474-2498
- family-names: McPherson
given-names: Jonathan
email: jonathan@posit.co
- family-names: Luraschi
given-names: Javier
- family-names: Ushey
given-names: Kevin
email: kevin@posit.co
- family-names: Atkins
given-names: Aron
email: aron@posit.co
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
- family-names: Cheng
given-names: Joe
email: joe@posit.co
- family-names: Chang
given-names: Winston
email: winston@posit.co
- family-names: Iannone
given-names: Richard
email: rich@posit.co
orcid: https://orcid.org/0000-0003-3925-190X
year: '2025'
doi: 10.32614/CRAN.package.rmarkdown
- type: software
title: testthat
abstract: 'testthat: Unit Testing for R'
notes: Suggests
url: https://testthat.r-lib.org
repository: https://CRAN.R-project.org/package=testthat
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
year: '2025'
doi: 10.32614/CRAN.package.testthat
version: '>= 3.0.0'
- type: software
title: parsedate
abstract: 'parsedate: Recognize and Parse Dates in Various Formats, Including All
ISO 8601 Formats'
notes: Imports
url: https://github.com/gaborcsardi/parsedate
repository: https://CRAN.R-project.org/package=parsedate
authors:
- family-names: Csárdi
given-names: Gábor
email: csardi.gabor@gmail.com
- family-names: Torvalds
given-names: Linus
year: '2025'
doi: 10.32614/CRAN.package.parsedate
- type: software
title: fastmap
abstract: 'fastmap: Fast Data Structures'
notes: Imports
url: https://r-lib.github.io/fastmap/
repository: https://CRAN.R-project.org/package=fastmap
authors:
- family-names: Chang
given-names: Winston
email: winston@posit.co
year: '2025'
doi: 10.32614/CRAN.package.fastmap
- type: software
title: jsonlite
abstract: 'jsonlite: A Simple and Robust JSON Parser and Generator for R'
notes: Imports
url: https://jeroen.r-universe.dev/jsonlite
repository: https://CRAN.R-project.org/package=jsonlite
authors:
- family-names: Ooms
given-names: Jeroen
email: jeroenooms@gmail.com
orcid: https://orcid.org/0000-0002-4035-0289
year: '2025'
doi: 10.32614/CRAN.package.jsonlite
- type: software
title: memoise
abstract: 'memoise: ''Memoisation'' of Functions'
notes: Imports
url: https://memoise.r-lib.org
repository: https://CRAN.R-project.org/package=memoise
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@rstudio.com
- family-names: Hester
given-names: Jim
- family-names: Chang
given-names: Winston
email: winston@rstudio.com
- family-names: Müller
given-names: Kirill
email: krlmlr+r@mailbox.org
- family-names: Cook
given-names: Daniel
email: danielecook@gmail.com
year: '2025'
doi: 10.32614/CRAN.package.memoise
- type: software
title: remotes
abstract: 'remotes: R Package Installation from Remote Repositories, Including ''GitHub'''
notes: Imports
url: https://remotes.r-lib.org
repository: https://CRAN.R-project.org/package=remotes
authors:
- family-names: Csárdi
given-names: Gábor
email: csardi.gabor@gmail.com
- family-names: Hester
given-names: Jim
- family-names: Wickham
given-names: Hadley
- family-names: Chang
given-names: Winston
- family-names: Morgan
given-names: Martin
- family-names: Tenenbaum
given-names: Dan
year: '2025'
doi: 10.32614/CRAN.package.remotes
- type: software
title: utils
abstract: 'R: A Language and Environment for Statistical Computing'
notes: Imports
authors:
- name: R Core Team
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2025'
- type: software
title: httr
abstract: 'httr: Tools for Working with URLs and HTTP'
notes: Imports
url: https://httr.r-lib.org/
repository: https://CRAN.R-project.org/package=httr
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
year: '2025'
doi: 10.32614/CRAN.package.httr
- type: software
title: vctrs
abstract: 'vctrs: Vector Helpers'
notes: Imports
url: https://vctrs.r-lib.org/
repository: https://CRAN.R-project.org/package=vctrs
authors:
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
- family-names: Henry
given-names: Lionel
email: lionel@posit.co
- family-names: Vaughan
given-names: Davis
email: davis@posit.co
year: '2025'
doi: 10.32614/CRAN.package.vctrs
- type: software
title: renv
abstract: 'renv: Project Environments'
notes: Imports
url: https://rstudio.github.io/renv/
repository: https://CRAN.R-project.org/package=renv
authors:
- family-names: Ushey
given-names: Kevin
email: kevin@rstudio.com
orcid: https://orcid.org/0000-0003-2880-7407
- family-names: Wickham
given-names: Hadley
email: hadley@rstudio.com
orcid: https://orcid.org/0000-0003-4757-117X
year: '2025'
doi: 10.32614/CRAN.package.renv
- type: software
title: here
abstract: 'here: A Simpler Way to Find Your Files'
notes: Imports
url: https://here.r-lib.org/
repository: https://CRAN.R-project.org/package=here
authors:
- family-names: Müller
given-names: Kirill
email: krlmlr+r@mailbox.org
orcid: https://orcid.org/0000-0002-1416-3412
year: '2025'
doi: 10.32614/CRAN.package.here
- type: software
title: lifecycle
abstract: 'lifecycle: Manage the Life Cycle of your Package Functions'
notes: Imports
url: https://lifecycle.r-lib.org/
repository: https://CRAN.R-project.org/package=lifecycle
authors:
- family-names: Henry
given-names: Lionel
email: lionel@posit.co
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
orcid: https://orcid.org/0000-0003-4757-117X
year: '2025'
doi: 10.32614/CRAN.package.lifecycle
- type: software
title: 'R: A Language and Environment for Statistical Computing'
notes: Depends
url: https://www.R-project.org/
authors:
- name: R Core Team
institution:
name: R Foundation for Statistical Computing
address: Vienna, Austria
year: '2025'
version: '>= 3.5.0'
GitHub Events
Total
- Issues event: 1
- Watch event: 3
- Delete event: 1
- Issue comment event: 2
- Push event: 4
- Pull request event: 5
- Create event: 1
Last Year
- Issues event: 1
- Watch event: 3
- Delete event: 1
- Issue comment event: 2
- Push event: 4
- Pull request event: 5
- Create event: 1
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| chainsawriot | c****y@g****m | 307 |
| schochastics | d****d@s****t | 74 |
| Egor Kotov | k****r@g****m | 35 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 47
- Total pull requests: 72
- Average time to close issues: 18 days
- Average time to close pull requests: 4 days
- Total issue authors: 6
- Total pull request authors: 4
- Average comments per issue: 2.23
- Average comments per pull request: 1.36
- Merged pull requests: 67
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: about 11 hours
- Issue authors: 1
- Pull request authors: 2
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- chainsawriot (41)
- schochastics (1)
- aghaynes (1)
- Howquez (1)
- B0BYorgurt (1)
- EagleoutIce (1)
Pull Request Authors
- chainsawriot (57)
- schochastics (10)
- ArthurMuehl (2)
- e-kotov (2)
Top Labels
Issue Labels
bug (5)
v0.3 (4)
v0.2 (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 214 last-month
- Total docker downloads: 21,683
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
cran.r-project.org: rang
Reconstructing Reproducible R Computational Environments
- Homepage: https://github.com/gesistsa/rang
- Documentation: http://cran.r-project.org/web/packages/rang/rang.pdf
- License: GPL (≥ 3)
-
Latest release: 0.3.0
published over 2 years ago
Rankings
Stargazers count: 7.7%
Forks count: 21.9%
Average: 25.9%
Dependent packages count: 29.8%
Downloads: 34.8%
Dependent repos count: 35.5%
Maintainers (1)
Last synced:
6 months ago