You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EpiModel provides get_network() and set_network() S3 methods for netsim_dat objects (defined in R/get.R), which correctly abstract over the tergmLite vs. full-mode network storage. However, 31 occurrences across 9 internal R files still access dat$run$nw directly, bypassing these accessors.
Motivation
Consistency: Extension module authors read internal code to learn patterns. Direct dat$run$nw access teaches the wrong pattern and may break if the internal structure changes.
Abstraction: The accessors handle tergmLite/full-mode differences internally. Direct access requires each call site to handle this distinction, which is error-prone.
Maintainability: If the internal storage structure changes, only the accessor implementations need updating rather than 31 call sites.
Scope
Files with direct dat$run$nw access (31 occurrences total):
File
Count
R/net.mod.init.R
7
R/saveout.R
4
R/update.R
4
R/net.fn.utils.R
3
R/net.mod.nwupdate.R
2
R/edgelists.R
1
Also 6 occurrences in inst/JSS/ and tests/testthat/ (lower priority).
Similarly, dat$run$el is accessed directly in several files and could benefit from the same treatment, though get_edgelist() already exists for read access.
Some internal call sites (e.g., net.mod.init.R initializing dat$run$nw <- nws) may need a dedicated initialization path rather than set_network(), since the object may not be fully constructed yet. These should be evaluated case by case.
Summary
EpiModel provides
get_network()andset_network()S3 methods fornetsim_datobjects (defined inR/get.R), which correctly abstract over the tergmLite vs. full-mode network storage. However, 31 occurrences across 9 internal R files still accessdat$run$nwdirectly, bypassing these accessors.Motivation
dat$run$nwaccess teaches the wrong pattern and may break if the internal structure changes.Scope
Files with direct
dat$run$nwaccess (31 occurrences total):R/net.mod.init.RR/saveout.RR/update.RR/net.fn.utils.RR/net.mod.nwupdate.RR/edgelists.RAlso 6 occurrences in
inst/JSS/andtests/testthat/(lower priority).Similarly,
dat$run$elis accessed directly in several files and could benefit from the same treatment, thoughget_edgelist()already exists for read access.Notes
get_network()/set_network()exclusively (PR Updates to Package Vignettes #976).net.mod.init.Rinitializingdat$run$nw <- nws) may need a dedicated initialization path rather thanset_network(), since the object may not be fully constructed yet. These should be evaluated case by case.