This package is still under active development. If you see this message, assume that several parts of the package don’t quite work yet.
flowdiagramr allows automated creation of flow diagrams for compartmental simulation models using ggplot. Other types of flow charts are also supported.
These few lines of code create a simple diagram of and SIR model using flowdiagramr
#install if needed - package is not yet on CRAN
# remotes::install_github('andreashandel/flowdiagramr')
library(flowdiagramr)
#specify model
mymodel = list( varlabels = c("S","I","R"),
flows = list(S_flows = c("-b*S*I"),
I_flows = c("b*S*I","-g*I"),
R_flows = c("g*I"))
)
#prepare diagram
diagram_list <- prepare_diagram(mymodel)
#make diagram
my_diagram <- make_diagram(diagram_list)
#plot diagram
plot(my_diagram)
If you think something like this is of interest to you, hop on over to the Quick Start tutorial (vignette).
flowdiagramr gives you many options to easily customize diagrams. You can also make diagrams that are not based on compartmental models. To explain (most) everything flowdiagramr can do, we wrote several tutorials/vignettes. Here they are listed for convenience.
Main tutorials/vignettes
You should go through them in this order
Additional tutorials/vignettes
Read them based on interest, in any order
- Making non-model based diagrams
- Additional diagram examples
- Additional topics
- Comparison to other R packages
The package website (if you are not already on it) is here. You can access all the tutorials from there, as well as some additional information.
This R package was developed by Andrew Tredennick and Andreas Handel. A full list of contributors and a Bibtex entry for the citation can be found here.
This project was/is partially supported by NIH grants R01 GM124280 and GM 12480-03S1.