R package that makes linux environment modules available from R.
You can install the released version of RLinuxModules from
CRAN with:
# Not released to CRAN
# install.packages("RLinuxModules")
And the development version from GitHub with:
# install.packages("devtools")
devtools::install_github("kiwiroy/RLinuxModules@main")
This is a basic example which shows you how to solve a common problem when using environment modules with R:
library(RLinuxModules)
# initialise
moduleInit(modulesHome = modulesHome)
# load samtools into the environment
module("load samtools")
# samtools should now be available
system("samtools", intern = TRUE)
While in a knitr code chunk using bash
as the engine.
# Environment is inherited in other code chunks.
which samtools
# see known issues below
module list
The Modules Environment now supports R scripting since version 4.0.
This package works by using the python support and translating the
python commands returned from modulecmd python into R commands. It has
only been tested for version 3.2.10
/bin/sh
is symlinked to /bin/dash
, dash
will sanitize the
environment in such a way that the module
function is not
available to the child bash
shell. See a bug
report
and Stack Overflow question
on the topic.