Hooks for loading R packages
setHook function can be used to add hooks when loading (or unloading) R
packages. For example, to update my previous post about replacing the
yesno function in
devtools can be improved by using hooks. The version in the original post
loaded devtools in every R session. By using hooks, the change to
takes place anytime devtools is loaded, but does not require devtools
loaded in every R session.
To improve this, we can first make sure devtools is actually installed on the system.
Make sure to
rm the objects otherwise they’ll exist in the environment when
you start a fresh R session.
Home | Back to blog