In my scripts, which I am currently making into a package, a number of "global settings" are needed. Currently, these settings are in global variables and were usually changed by editing the script directly. (The script produces entries for a database, and you need to adjust stuff like "author name" and other custom "constant" part of the entries.)
Again, currently I used const_author <- "Meow The Scientist Cat"
et al. I can, of course, leave this exactly as is, and export all the global variables, so the user can set them to whatever. However, this is ugly, and pollutes the namespace.
What is the standard method in R to make such settings available to the user? Using options()? And at which point in the package should these options be loaded?
Maybe using a function like settingsTemplate(filename)
which exports a file with default settings, which the user then can customize; and he has to source the file or loadSettings (filename) before using the scripts?
You could create something similar to xcms: in zzz.R
we call .setXCMSOptions
(from init.R
upon package loading, where xcms specific options are inserted into the generic BioC options:
getOption("BioC")$xcms
You could provide getter and setter methods for your options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With