https://github.com/nanhung/mcsim_under_r
The toolbox to run GNU MCsim under R(Studio)
https://github.com/nanhung/mcsim_under_r
gnu-mcsim
Last synced: 8 months ago
JSON representation
The toolbox to run GNU MCsim under R(Studio)
- Host: GitHub
- URL: https://github.com/nanhung/mcsim_under_r
- Owner: nanhung
- License: lgpl-3.0
- Created: 2018-07-01T21:15:40.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-30T19:40:16.000Z (almost 3 years ago)
- Last Synced: 2025-09-13T05:03:02.551Z (9 months ago)
- Topics: gnu-mcsim
- Language: C
- Homepage:
- Size: 2.74 MB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MCSim under R
This MCSim sandbox aim to help the beginner (especially Windows user) run GNU MCSim (current version 6.1.0) in R.
## Prerequisites
- R ()
- RStudio ()
- Rtools ()
## Instruction
(1) Download all files from this repository or [HERE](http://filr.cvm.tamu.edu:8080/ssf/s/readFile/share/1947/7338824215326083511/publicLink/MCSim_under_R_beta_1.zip).
(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 in `MCSim_under_R`, such as `C:/Users/nanhung/MCSim_under_R`. The default install location of Rtools is `c:/Rtools`.
### Workflow
The workflow of MCSim under R can separate into three levels as following diagram,

## Functions
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](https://www.gnu.org/software/mcsim/mcsim.html#Using-makemcsim) in GNU MCSim. The `model` assignment is a string giving the name of the model-file (e.g., `"pbpk.model.R"`). The `deSolve` 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](https://www.gnu.org/software/mcsim/mcsim.html#Running-Simulations). The `input` assignment is a string giving the name of the input-file (e.g., `"linear.in.R"`).
### Help
- Welcome to submit your problem in [issues](https://github.com/nanhung/MCSim_under_R/issues)
- For more detail, please see [this tutorial slide](https://nanhung.rbind.io/slide/190418_tutorial.html#1)
### Reference
- [GNU MCSim website](https://www.gnu.org/software/mcsim/)
- R. Woodrow Setzer. [Dynamic Modeling using MCSim and R](https://www.toxicology.org/groups/ss/BMSS/DynamicModelingwith%20MCsimandR.pdf)
- [MCSim under R (Windows)](https://nanhung.rbind.io/post/mcsim-under-r-windows/)
- [Using MCSim on Windows with RStudio](https://rpubs.com/Nanhung/MCSim_with_RStudio)