compileRcpp | R Documentation |
SimBIID_model
objectCompiles an object of class SimBIID_model
into an
XPtr
object for use in Rcpp functions, or an
object of class function
for calling directly from R.
compileRcpp(model)
model |
An object of class |
An object of class XPtr
that points to the compiled function, or
an R function
object for calling directly from R.
mparseRcpp
## set up SIR simulationmodel transitions <- c( "S -> beta * S * I -> I", "I -> gamma * I -> R" ) compartments <- c("S", "I", "R") pars <- c("beta", "gamma") model <- mparseRcpp( transitions = transitions, compartments = compartments, pars = pars ) ## compile model to be run directly model <- compileRcpp(model) model ## set initial states (1 initial infection ## in population of 120) iniStates <- c(S = 119, I = 1, R = 0) ## set parameters pars <- c(beta = 0.001, gamma = 0.1) ## run compiled model model(pars, 0, 100, iniStates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.