Closed avallecam closed 1 year ago
I think option (2) is best here as it doesn't require pacman
. I've removed data.table
and preferred base R funs to work with data frame.
I agree! Additionally, this can be also applied in the other vignettes:
in varying_susceptibility.Rmd
there is no use of {data.table}
, so we can remove library(data.table)
https://github.com/epiverse-trace/finalsize/blob/f0ac4127e54579754d08ee92754203f99c0f6ee9/vignettes/varying_susceptibility.Rmd#L58
in uncertainty_params.Rmd
the {data.table}
package it is only used for one function, so we can remove library(data.table)
and add it here data.table::rbindlist()
https://github.com/epiverse-trace/finalsize/blob/f0ac4127e54579754d08ee92754203f99c0f6ee9/vignettes/uncertainty_params.Rmd#L57
https://github.com/epiverse-trace/finalsize/blob/f0ac4127e54579754d08ee92754203f99c0f6ee9/vignettes/uncertainty_params.Rmd#L145
I think you might be referring to an older version of these files - I don't use {data.table}
at all now, and data.table::rbindlist
has been replaced with Reduce(f = rbind, ...)
Right, thanks for the clarification!
I have three alternatives for this chunk: https://github.com/epiverse-trace/finalsize/blob/f0ac4127e54579754d08ee92754203f99c0f6ee9/vignettes/finalsize.Rmd#L61-L67
(1) This alternative propose to use
pacman
to simplify two steps:An argument for not using
pacman
here is that it may be more useful for reproducible workflows than for package documentation. But showing it here could also highlight our preference for it in user projects.(2) This one avoids evaluating the availability and installation of external packages. But propose to remove
library(data.table)
because, similar tosocialmixer
, it is used for one function of secondary relevance, with respect tofinalsize
andggplot2
:This modification requires to call
data.table
with the double-colon notationdata.table::merge.data.table()
here: https://github.com/epiverse-trace/finalsize/blob/f0ac4127e54579754d08ee92754203f99c0f6ee9/vignettes/finalsize.Rmd#L236(3) This last one avoids using
pacman
but uses longer code to evaluate the availability and installation of packages. Also, it is consistent with #117 :This one also requires to call
data.table
with the double-colon notationdata.table::merge.data.table()
here: https://github.com/epiverse-trace/finalsize/blob/f0ac4127e54579754d08ee92754203f99c0f6ee9/vignettes/finalsize.Rmd#L236