This MCSim sandbox aim to help the beginner (especially Windows user) run GNU MCSim (current version 6.1.0) in R.
- R (https://cran.r-project.org/)
- RStudio (https://www.rstudio.com/)
- Rtools (https://cran.r-project.org/bin/windows/Rtools/)
(1) Download all files from this repository or HERE.
(2) Open "MCSim_under_R.Rproj"
.
(3) Open the R script in examples folder and follow the guidance to do the simple test run.
- Note: Use
getwd()
in R to make sure your working directory is inMCSim_under_R
, such asC:/Users/nanhung/MCSim_under_R
. The default install location of Rtools isc:/Rtools
.
The workflow of MCSim under R can separate into three levels as following diagram,
Here are the R functions that can help you run MCSim in R environment more easily. All R functions are put in functions.R
in MCSim folder.
makemcsim(model, deSolve)
: Preprocessing and compiling the model-file to the executable file as makemcsim in GNU MCSim. Themodel
assignment is a string giving the name of the model-file (e.g.,"pbpk.model.R"
). ThedeSolve
assignment is a logical factor to use deSolve package as an ODE solver.mcsim(model, input)
: Using the compiled program with the input-file to run simulation. See Running Simulations. Theinput
assignment is a string giving the name of the input-file (e.g.,"linear.in.R"
).
-
Welcome to submit your problem in issues
-
For more detail, please see this tutorial slide