Construct objects for accessing and caching model definition files.
Usage
ModelFiles(
model_directory,
csv_reader = CSVReader,
json_reader = JSONReader,
txt_reader = TXTReader
)
Arguments
- model_directory
String giving a path to a directory containing the following files,
variables.csv
,derivations.json
,flows.csv
, andsettings.json
, described by this spec.- csv_reader
Class inheriting from
Reader
for reading csv files.- json_reader
Class inheriting from
Reader
for reading json files.- txt_reader
Class inheriting from
Reader
for reading txt files.
Examples
d = system.file("starter_models", "seir_symp_vax", package = "macpan2")
m = ModelFiles(d)
m$flows()
#> from to flow type from_partition to_partition flow_partition
#> 1 S E foi per_capita Epi Epi Epi
#> 2 E I alpha per_capita Epi Epi Epi
#> 3 I R gamma per_capita Epi Epi Epi
#> 4 unvax vax dose_rate per_capita Vax Vax Vax
#> from_to_partition from_flow_partition to_flow_partition
#> 1 Vax Null
#> 2 Vax Null
#> 3 Vax Symp Null
#> 4 Epi.Symp.SympStruc Null
expander = FlowExpander(m)
expander$expand_flows()
#> from to flow
#> 1 S..unstructured.unvax E..unstructured.unvax foi..unstructured.unvax
#> 2 S..unstructured.unvax E..unstructured.unvax foi..unstructured.vax
#> 3 S..unstructured.vax E..unstructured.vax foi..unstructured.unvax
#> 4 S..unstructured.vax E..unstructured.vax foi..unstructured.vax
#> 5 E..unstructured.unvax I.mild.component.unvax alpha..unstructured.
#> 6 E..unstructured.unvax I.severe.component.unvax alpha..unstructured.
#> 7 E..unstructured.vax I.mild.component.vax alpha..unstructured.
#> 8 E..unstructured.vax I.severe.component.vax alpha..unstructured.
#> 9 I.mild.component.unvax R..unstructured.unvax gamma.mild.component.
#> 10 I.severe.component.unvax R..unstructured.unvax gamma.severe.component.
#> 11 I.mild.component.vax R..unstructured.vax gamma.mild.component.
#> 12 I.severe.component.vax R..unstructured.vax gamma.severe.component.
#> 13 S..unstructured.unvax S..unstructured.vax ..unstructured.dose_rate
#> 14 E..unstructured.unvax E..unstructured.vax ..unstructured.dose_rate
#> 15 I.mild.component.unvax I.mild.component.vax ..unstructured.dose_rate
#> 16 I.severe.component.unvax I.severe.component.vax ..unstructured.dose_rate
#> 17 R..unstructured.unvax R..unstructured.vax ..unstructured.dose_rate
#> type
#> 1 per_capita
#> 2 per_capita
#> 3 per_capita
#> 4 per_capita
#> 5 per_capita
#> 6 per_capita
#> 7 per_capita
#> 8 per_capita
#> 9 per_capita
#> 10 per_capita
#> 11 per_capita
#> 12 per_capita
#> 13 per_capita
#> 14 per_capita
#> 15 per_capita
#> 16 per_capita
#> 17 per_capita