This is a Heroku buildpack for applications which use R for statistical computing and CRAN for R packages.
R is ‘GNU S’, a freely available language and environment for statistical computing and graphics which provides a wide variety of statistical and graphical techniques: linear and nonlinear modelling, statistical tests, time series analysis, classification, clustering, etc. Please consult the R project homepage for further information.
CRAN is a network of ftp and web servers around the world that store identical, up-to-date, versions of code and documentation for R.
Example usage:
$ ls
init.r prog1.r prog2.r ...
$ heroku create --stack cedar-14 --buildpack http://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14
$ git push heroku master
...
-----> Heroku receiving push
-----> Fetching custom buildpack
-----> R app detected
-----> Vendoring R x.xx.x
Executing init.r script
...
-----> R successfully installed
The buildpack will detect your app makes use of R if it has the init.r
file in the root.
The R runtime is vendored into your slug, and includes the gcc compiler for fortran support.
To reference a specific version of the build pack, add the Git branch or tag name to the end of the build pack URL.
$ heroku create --stack cedar-14 --buildpack http://github.com/virtualstaticvoid/heroku-buildpack-r.git#master
During the slug compilation process, the init.r
R file is executed. Put code in this file to install any packages you may require.
See the Installing-packages for details. The
list of available packages can be found at http://cran.r-project.org.
# Example `init.r` file
install.packages("nlme", dependencies = TRUE)
R packages can also be included in your project source and installed when the init.r
file is executed.
install.packages("optional-path-to-packages/local-r-package-file.tar.gz", repos=NULL, type="source")
You can also run the R console application as follows:
$ heroku run R
Type q()
to exit the console when you are finished.
Note that the Heroku slug is read-only, so any changes you make during the session will be discarded.
You can use the Heroku scheduler to schedule a recurring R process.
The following command would run prog.r
:
R -f ./prog.r --gui-none --no-save
This buildpack can be used in conjunction with other supported language stacks on Heroku by using multiple buildpacks. See Using Multiple Buildpacks for an App.
See the example test applications which show how to use R from the console and various other examples.
The binaries used by the buildpack are hosted on AWS S3 at s3://heroku-buildpack-r.
See the heroku-buildpack-r-build repository for building the R binaries yourself.
Optionally, the R version and buildpack version can be configured by providing a .r-version
and .r-buildpack-version
file in the root directory.
These files should contain 1 line of text containing the respective version. See alternate-versions for an example.
The following versions are available:
R Version | Buildpack Version | Binary |
---|---|---|
2.15.1 | 20131211-0028 | R-2.15.1-binaries-20131211-0028.tar.gz |
3.0.2 | 20140218-0019 | R-3.0.2-binaries-20140218-0019.tar.gz |
3.1.0 | 20141127-0021 | R-3.1.0-binaries-20141127-0021.tar.gz |
3.1.2 | 20150301-1046 | R-3.1.2-binaries-20150301-1046.tar.gz |
NB: Remember to use the http://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar
branch for the buildpack URL.
(all versions for cedar-14 have been rebuilt on 2016-07-20 due to improvements made to the build process)
R Version | Buildpack Version | Binary |
---|---|---|
3.1.0 | 20160720-0310 | R-3.1.0-binaries-20160720-0310.tar.gz |
3.1.1 | 20160720-0311 | R-3.1.1-binaries-20160720-0311.tar.gz |
3.1.2 | 20160720-0312 | R-3.1.2-binaries-20160720-0312.tar.gz |
3.1.3 | 20160720-0313 | R-3.1.3-binaries-20160720-0313.tar.gz |
3.2.0 | 20160720-0320 | R-3.2.0-binaries-20160720-0320.tar.gz |
3.2.1 | 20160720-0321 | R-3.2.1-binaries-20160720-0321.tar.gz |
3.2.2 | 20160720-0322 | R-3.2.2-binaries-20160720-0322.tar.gz |
3.2.3 | 20160720-0323 | R-3.2.3-binaries-20160720-0323.tar.gz |
3.2.4 | 20160720-0324 | R-3.2.4-binaries-20160720-0324.tar.gz |
3.2.5 | 20160720-0325 | R-3.2.5-binaries-20160720-0325.tar.gz |
3.3.0 | 20160720-0330 | R-3.3.0-binaries-20160720-0330.tar.gz |
3.3.1 | 20160720-0331 | R-3.3.1-binaries-20160720-0331.tar.gz |
NB: Remember to use the http://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14
branch for the buildpack URL.
See BUILDS for older/deprecated listing of builds.
Due to the size of the R runtime, the slug size on Heroku, without any additional packages or program code, is approximately 90Mb.
If additional R packages are installed by the init.r
script then the slug size will increase.
Original inspiration from Noah Lorang's Rook on Heroku project.
MIT License. Copyright (c) 2013 Chris Stefano. See MIT_LICENSE for details.