Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would a default control function be worthwhile? #80

Open
TimTaylor opened this issue Oct 28, 2022 · 1 comment
Open

Would a default control function be worthwhile? #80

TimTaylor opened this issue Oct 28, 2022 · 1 comment
Labels
Discussion Related to a discussion about the package: new and existing features and concepts

Comments

@TimTaylor
Copy link

I wonder if this should call a default_control() function. This may be a little more tractable/transparent?

finalsize/R/final_size.R

Lines 128 to 134 in e059839

final_size <- function(r0 = 2.0,
contact_matrix,
demography_vector,
p_susceptibility,
susceptibility,
solver = c("iterative", "newton"),
control = list()) {

It could become something like

 final_size <- function(r0 = 2.0, 
                        contact_matrix, 
                        demography_vector, 
                        p_susceptibility, 
                        susceptibility, 
                        solver = c("iterative", "newton"), 
                        control = default_controls(solver)) { 
@pratikunterwegs
Copy link
Collaborator

I agree that control = list() is a bit opaque, and in general I am in favour of being upfront about default arguments. Now that the proposed function body in #73 has a default control list creation step, with user values overriding the defaults if passed, this may be a bit more transparent to users?

@pratikunterwegs pratikunterwegs added the Discussion Related to a discussion about the package: new and existing features and concepts label Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Related to a discussion about the package: new and existing features and concepts
Projects
None yet
Development

No branches or pull requests

2 participants