R is a free software environment for statistical computing and graphics.
R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R.
R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, …) and graphical techniques, and is highly extensible. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity.
One of R’s strengths is the ease with which well-designed publication-quality plots can be produced, including mathematical symbols and formulae where needed. Great care has been taken over the defaults for the minor design choices in graphics, but the user retains full control.
R is available as Free Software under the terms of the Free Software Foundation’s GNU General Public License in source code form. It compiles and runs on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), Windows and MacOS.
This container includes the R-littler package. R-littler provides hash-bang (#!) capability for R. Launches GNU R to execute the specified file containing R commands, or takes commands from stdin if '-' is used to denote stdin, using the specified options. This makes it suitable to create R scripts via the so-called shebang '#!/' line.
For example, this file has been created in /var/local/R/test.r:
#!/usr/bin/r -p set.seed(955) xvar <- 1:20 + rnorm(20,sd=3) zvar <- 1:20/4 + rnorm(20,sd=2) yvar <- -2*xvar + xvar*zvar/5 + 3 + rnorm(20,sd=4) dat <- data.frame(x=xvar, y=yvar, z=zvar) head(dat)
Run the container with the following invocation:
docker run -v /var/local/R:/var/local/R --rm -t -i --name=r-devel brunswickheads/r-devel-s390x /var/local/R/test.r
This will result in the following output:
x y z 1 -4.252354 4.5857688 1.89877152 2 1.702318 -4.9027824 -0.82937359 3 4.323054 -4.3076433 -1.31283495 4 1.780628 0.2050367 -0.28479448 5 11.537348 -29.7670502 -1.27303976 6 6.672130 -10.1458220 -0.09459239
If you wish to enter the R environment rather than invoking R-littler, simply start your container using, for example:
# docker run -v /var/local/R:/var/local/R --rm -t -i --name=r-devel brunswickheads/r-devel-s390x R R version 3.2.4 (2016-03-10) -- "Very Secure Dishes" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: s390x-ibm-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. Natural language support but running in an English locale 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.2.4 (2016-03-10) Platform: s390x-ibm-linux-gnu (64-bit) Running under: ClefOS Linux 7 (Core) locale:  LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C  LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8  LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8  LC_PAPER=en_US.UTF-8 LC_NAME=C  LC_ADDRESS=C LC_TELEPHONE=C  LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages:  stats graphics grDevices utils datasets methods base > q() Save workspace image? [y/n/c]: n
Adding your own Packages
The container has built the docopt package and it lives in
/usr/local/lib/R/site-library. This is where all added packages will be placed. If you wish to add your own you will need to union mount that directory. This will mean you'll lose that package. However, it and others are quite easy to add:
docker run -v /var/local/R:/usr/local/lib/R/site-library --rm -t -i --name=r-devel brunswickheads/r-devel-s390x bash bash-4.2# /usr/lib64/R/library/littler/examples/install.r docopt also installing the dependencies ‘stringi’, ‘magrittr’, ‘stringr’ trying URL 'https://cran.rstudio.com/src/contrib/stringi_1.0-1.tar.gz' Content type 'application/x-gzip' length 3643002 bytes (3.5 MB) ================================================== downloaded 3.5 MB : ** building package indices ** testing if installed package can be loaded * DONE (docopt) The downloaded source packages are in ‘/tmp/downloaded_packages’ bash-4.2# /usr/lib64/R/library/littler/examples/install.r ggplot2 also installing the dependencies ‘colorspace’, ‘Rcpp’, ‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘digest’, ‘gtable’, ‘plyr’, ‘reshape2’, ‘scales’ trying URL 'https://cran.rstudio.com/src/contrib/colorspace_1.2-6.tar.gz' Content type 'application/x-gzip' length 247027 bytes (241 KB) ================================================== : ** testing if installed package can be loaded * DONE (ggplot2) The downloaded source packages are in ‘/tmp/downloaded_packages’