-
Notifications
You must be signed in to change notification settings - Fork 36
mrgsolve Installation
- Prerequisites
- Compilers
- Obtaining
mrgsolve
- Dependencies
- Example installation code
- Upgrading to a new version
-
R
: https://cran.r-project.org/- Currently R >=
3.1.2
is required -
IMPORTANT Install
R
in a location such that no spaces are in the path toR
executable; this is usually not an issue onunix
type machines (linux
orMacOSX
) but can cause problems onwindows
. This means, do not installR
inc:\Program Files
; you won't be able to install packages from source or compile your model. For reference see this answer on SO.
- Currently R >=
- Seriously consider running in Rstudio if possible. This is not required but is recommended.
- Compilers:
C++
andgfortran
(see theCompilers
section below)
There is a separate wiki page for information on compilers required to use mrgsolve
. Please visit that page and make sure the compiler is properly installed before proceeding to the next steps.
- Get the latest release here
- To install
mrgsolve
from the downloaded package, see instructions below
- To install
- Get the development version with the
devtools
package:
library(devtools)
devtools::install_github("metrumresearchgroup/mrgsolve", subdir="rdev", type="source")
Installing mrgsolve
via install_github
will also install required dependencies. It is best practice to use the most recent version of mrgsolve
and recent versions of all depencencies. The following section will discuss what depencencies are required.
See https://cran.r-project.org/web/packages/ or R> help("INSTALL")
or R> help("install.packages")
for help.
The following required packages must be installed before installing mrgsolve
:
BH
Rcpp
RcppArmadillo
dplyr
All of these required packages are available on CRAN
. mrgsolve
imports from dplyr
and links to BH
, Rcpp
, and RcppArmadillo
. For the purposes of this document, they will be referred to as dependencies insofar as they are required to install and run mrgsolve
. But note well that they are not technically dependencies the way R
uses that term. Only the package namespaces and not the packages themselves will be loaded when mrgsolve
is loaded.
There are minimum version numbers for each dependency. R will issue an error during mrgsolve
installation if insufficient versions of dependencies are currently installed. See the DESCRIPTION
file in the .tar.gz
archive for minimum dependency version numbers. Also, note that each required package with respect to mrgsolve
may have requirements of their own. Install all required packages and their requirements as well prior to installing mrgsolve
.
NOTE: Rcpp
and RcppArmadillo
must be installed from source packages (e.g. install.packages("Rcpp", type="source")
). Also, whenever new versions of Rcpp
, RcppArmadillo
or mrgsolve
are installed, it is good practice to re-install / re-compile all three of these packages (see Compilers
below).
These packages may be needed to perform certain tasks in mrgsolve
:
lattice
testthat
XML
R
users usually already have lattice
installed on their system. testthat
and XML
are only required for a few tasks and the majority of the simulation work can be done without them.
Point the installation to your favorite CRAN
repository:
repos <- "http://cran.us.r-project.org"
This little function will ensure that source packages are installed from CRAN
; do NOT install binary packages.
install <- function(x,...) install.packages(x,type="source",repos=repos,...)
Install dependencies:
install("Rcpp")
install("RcppArmadillo")
install("BH")
install("dplyr")
To install version 0.7.1
from the source tarball:
Check that you can find the tarball. For example:
file.exists("mrgsolve_0.7.1.tar.gz")
Use the name of the tarball that you downloaded and the path to that file. If this doesn't come back TRUE
, modify the command (file name or path) untill R
can find it.
Install:
install.packages("mrgsolve_0.7.1.tar.gz", repos=NULL, type="source")
Note that repos
is set to NULL
and we are telling R
that the package is source
, not binary
. Also, we assume that the mrgsolve_0.7.1.tar.gz
file is in the current working directory (see previous check).
To install other versions of mrgsolve
, use the appropriate version number in for the tarball that you are trying to install (e.g. mrgsolve_a.b.xyz.tar.gz
).
mrgsolve
and all depencencies can be installed with this command
library(devtools)
install_github("metrumresearchgroup/mrgsolve@v0.7.1", subdir="rdev", type="source")
library(mrgsolve)
?mrgsolve
example("mrgsolve")
Users are encouraged to re-install or re-compile Rcpp
and RcppArmadillo
prior to upgrading to a new version of mrgsolve
. To upgrade mrgsolve
, simply follow the install step above.
© 2016 Metrum Research Group, LLC
www.metrumrg.com