Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store package-specific settings in R: options() vs. ReferenceClasses

Tags:

r

I'm just thinking out loud about this one. So far I was saving all package-specific settings in options. I have some experience with ReferenceClasses (thanks to Rook), and I've seen that knitr uses RC to save package-specific staff. I'd like to know more about pros/cons of both approaches. Or maybe you'd like to recommend another approach (e.g. sourcing R file located in getwd() on startup, much like devtools and .Rpackages)?

Ideas?

like image 696
aL3xa Avatar asked Mar 28 '12 18:03

aL3xa


1 Answers

You can also store options in an environment stored at the top-level of your package. That may be closest to options() use, while avoiding the global variable.

like image 185
Dirk Eddelbuettel Avatar answered Oct 18 '22 21:10

Dirk Eddelbuettel