From Wikibooks, open books for an open world
Jump to: navigation, search

R is a free software environment for statistical computing and graphics. The R project is responsible for R. Packages for R are provided by the Comprehensive R Archive Network (CRAN). R is cross-platform and supported on Windows, MacOS X, and Linux.

In addition, R scripts (as can gnuplot scripts) can be use to process GLPK output directly, without the use of dedicated R packages.


Package glpk is provided by CRAN — which also contains the reference manual. Glpk is based on GLPK 4.8 and has not been updated since 2006.

To install (from within R):


It would seem sensible to update the GLPK library before using this package for substantial work. Many of the 4.8 GLPK calls have been deprecated, so an upgrade will involve some additional programming effort. That said, the basic structure of the package should still serve as a template.


Package Rglpk is provided by CRAN — which also contains the reference manual.

To install (from within R):


Rglpk offers an R interface to GLPK (version 4.42 as at 30 June 2010) and a high-level R interface to the MPS and CPLEX LP readers of GLPK. As such, Rglpk provides a way of running MPS and CPLEX LP models from within R, but does not provide support for MathProg-style programming from within R. (Other R packages might well support AMPL or GAMS-style programming?)

Debian-based Linux users can also install Rglpk via the Debian package r-cran-rglpk. But it would pay to check on currency.