Replies: 3 comments 12 replies
-
I don't really like using the options. It feels like some global state that departs from the grammar. my_function <- function(x, opt = getOption("mypackage.opt", default = NULL)) {
opt <- opt %||% compute_default(x)
...
} |
Beta Was this translation helpful? Give feedback.
-
I think the answer also depends heavily on whether the package plans to simply read ("get") options, or also write ("set") options to different values in different contexts (aside from initializing them). I keep bookmarked some advice for taming the side-effect behavior of
Edit: for the record, I also don't really like using |
Beta Was this translation helpful? Give feedback.
-
One place where I felt really grateful for options, and where it also felt like it made sense and was justified is That said, my use case might not be as compelling. Something like... options(ggregion.geo.ref.data = northcarolina_counties, ggregion.required.aes = "fips|county.name" Then exported functions geom_region() and friends would be able to just work in the northcarolina county context, I think. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What are best practices for using options or similar.
Beta Was this translation helpful? Give feedback.
All reactions