Installing the R Package
To begin, you'll need to install the Gurobi package in R. The R command for doing this is:
install.packages('<R-package-file>', repos=NULL)The R package file can be found in the
<installdir>/R
directory of your Gurobi installation.
For a default installation of Gurobi 6.5.0, the command would be:
- Linux:
install.packages('/opt/gurobi650/linux64/R/gurobi_6.5-0_R_x86_64-unknown-linux-gnu.tar.gz', repos=NULL) - Windows:
install.packages('c:\gurobi650\win64\R\gurobi_6.5-0.zip', repos=NULL)
- Mac:
install.packages('/Library/gurobi650/mac64/R/gurobi_6.5-0.tgz', repos=NULL)
You will need to be careful that the R binary and the Gurobi package you install both use the same instruction set. For example, if you are using the 64-bit version of R, you'll need to install the 64-bit version of Gurobi, and the 64-bit Gurobi R package. This is particularly important on Windows systems, where the error messages that result from instruction set mismatches can be quite cryptic.
If you are using R from RStudio Server, and you get an error
indicating that R is unable to load the Gurobi DLL or shared object,
you may need to set the rsession-ld-library-path
entry in the
server config file. Please consult the RStudio documentation for more
information.