I have historically in my packages set various options and auto-authentication via .onAttach
and .onLoad
but am not clear which is best to use.
For example googlesheets uses .onLoad
to set options which I have taken my cue from but I wonder for options that are meant to be set by the user its better to set them .onAttach
, with .onLoad
saved only for non-user set options?
As I understand it now, .onAttach
is called when a user types library(your_package)
but I'm not so clear when .onLoad
is called.
Are there any rules of thumb for when to use one other another?