Code Organisation
consider downplaying role of R6. Maybe overkill for users?
Originally posted by @robchallen in #152
R6 Classes
From discussion with Rob, I'm thinking potential approach may be:
- Remove mention from R6 classes from book
- Where I have used them, wrap in functions
For reference, the only place I have used R6 classes is in code for choosing the number of replications.
https://pythonhealthdatascience.github.io/des_rap_book/pages/guide/output_analysis/n_reps.html#automated
There are three R6 classes: WelfordStats, ReplicationTabuliser and ReplicationsAlgorithm.
Why are they classes? Because I was converting from Python package sim-tools which uses classes, so I just followed the same logic.
In terms of readers of the book and what they need to understand - they don't really need to understand R6 - we suggest they use functions as that's typical to R - and here, they just use them like below, but could just have a wrapper.
# Set up algorithm
alg <- ReplicationsAlgorithm$new(
param = create_params(warm_up_period = 10000L,
data_collection_period = 10000L),
metrics = metrics
)
# Run algorithm
alg$select()
# View recommended number of replications
alg$nreps
UPDATE: Do also talk about quite alot on the parameter validation page.
_Originally posted by @amyheather in #152
Originally posted by @robchallen in #152
_Originally posted by @amyheather in #152