epiverse-trace / epidemics

A library of published compartmental epidemic models, and classes to represent demographic structure, non-pharmaceutical interventions, and vaccination regimes, to compose epidemic scenarios.
https://epiverse-trace.github.io/epidemics/
Other
8 stars 2 forks source link

Access intervention names #189

Open pratikunterwegs opened 5 months ago

pratikunterwegs commented 5 months ago

This issue requests a function to more easily access intervention names. An alternative is to have c.*_intervention() construct names by combining component names.

It could save users lots of time to have a helper function to automatically extract from the intervention_scenarios object, e.g.

extract_names <- function(scenario) {
  names <- sapply(scenario, function(x) x$name)
  paste(names, collapse = " + ")
}

labels <- sapply(intervention_scenarios, extract_names)
labels[names(labels)=="baseline"] <- "None"

Although have noticed that combined_intervention just pulls the name of the first one included. Perhaps neater for this vignette to define like the other combined scenarios? Unless I'm missing an easy way to grab both intervention names?

_Originally posted by @adamkucharski in https://github.com/epiverse-trace/epidemics/pull/176#discussion_r1504992073_