Resetting options to their defaults can be a little cumbersome (I have just come from look around here, and here)
It could be useful to have something easily available, perhaps:
reset_options <- function() {
default_opts <- callr::r(function(){options()})
options(default_opts)
}
Note: there may already be easier/better ways of doing this. Apologies in advance if that's the case here
You may want to consider using callr::r_vanilla()
to do this, so that any options changed in your .Rprofile are not included.
But in general I don't think this function needs to be in devtools.
Base R should arguably expose the (default) options in some programmatic way. I've also often wanted a way to see the options "in force" and understand which are R defaults vs., say, set via an .Rprofile
. Basically something like git config --list --show-origin
. You @stevecondylios might consider opening an issue here: https://github.com/HenrikBengtsson/Wishlist-for-R/issues
Also, you should be aware of withr, which allows you to temporarily set options.