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

`intervention()` function returns an extra element that comes as an empty string `""` #122

Closed Karim-Mane closed 11 months ago

Karim-Mane commented 11 months ago

Bugs may include behaviour that does not impact package functionality, but which seems as though it might not be intended by the package developers.

Please place an "x" in all the boxes that apply


Please include a brief description of the problem with a code example: In test-interventions.R, the object returned by the intervention() constructor is composed of 5 elements instead of 4. The extra element is an empty string (""). This makes the test that checks if the contact intervention is correctly initialised fail.

close_schools <- intervention(
  name       = "close_schools",
  type       = "contacts",
  time_begin = 100L,
  time_end   = 150L,
  reduction  = matrix(c(0.2, 0.0))
)
names(close_schools)

Please include a brief description of the problem with a code example: I assume that this related to the ... argument in the new_intervention() constructor.

structure(
    list(
      name       = name,
      time_begin = time_begin,
      time_end   = time_end,
      reduction  = reduction,
      ...
    ),
    class = c(class, "intervention")
  )

Karim-Mane commented 11 months ago

I figure out the issue with this.

I modified the constructors prototypes to comply with the expectation from {lintr} (argument order: unnamed arguments first before the named arguement).

I have restored the previous prototype and add in # nolint: function_integer_linter on the corresponding lines.

pratikunterwegs commented 11 months ago

Thanks for looking into this and solving it @Karim-Mane