[R-pkg-devel] Recommendations about adding options to a package in order to change default values of some functions on-the-fly

Samuel @@muel@gr@nje@ud @ending from in@erm@fr
Thu Sep 6 17:02:43 CEST 2018


Hi,

I would like to change the default value of some arguments of some 
functions in a package of mine. I don't want to change explicitly the 
calls in the many scripts that have been written. For example, I would 
to change the delimiter in all write.mytable() without changing any 
calls it and without changing the default value currently assigned to 
that delimiter in the declaration of this function. What I would like is 
to add a command at the beginning of the scripts that says "since now, 
the delimiter is ;".

I am thinking about setting global options that those functions will 
read and use to overwrite the default values. Of course the 
write.mytable function has to be modify to exploit these settings, but 
none of the scripts. I think about something similar to the par() and 
options() functions.

I noticed the settings package, but I would like to know if there is a 
simple and recommended solution without adding any dependency.

Hope my question is clear.

Thanks for any advice,
Samuel



More information about the R-package-devel mailing list