Closed aronatkins closed 2 years ago
This is because the single-property setter is effectively a call to ::set_opts
, which assumes all options are being set. The same effect can be seen below, but is expected, here.
packrat::set_opts(ignored.packages = c("emo"), persist = FALSE)
packrat::set_opts(snapshot.recommended.packages = TRUE, persist = FALSE)
packrat::get_opts(c("ignored.packages"))
# => NULL
A workaround is to read all the packrat options, adjust the single target, then set all options together.
packrat::set_opts(ignored.packages = c("emo"), persist = FALSE)
o <- packrat::get_opts()
o[["snapshot.recommended.packages"]] <- TRUE
do.call(packrat::set_opts, o)
packrat::get_opts(c("ignored.packages", "snapshot.recommended.packages"))
# => [1] "emo" "TRUE"
Using the option setter clears other configured options.
This is using the setter defined by:
https://github.com/rstudio/packrat/blob/c648ce2fb915289d3de5c58eae9b15202a839163/R/options.R#L173-L179
the setter is connected to the
packrat::opts
here:https://github.com/rstudio/packrat/blob/c648ce2fb915289d3de5c58eae9b15202a839163/R/options.R#L221-L223