These functions allow users to set actions to be taken before packages are attached/detached and namespaces are (un)loaded.
getHook(hookName)
setHook(hookName, value,
action = c("append", "prepend", "replace"))<p></p><p>packageEvent(pkgname,
event = c("onLoad", "attach", "detach", "onUnload"))</p>
| Parameter | Description |
|---|---|
hookName |
character string: the hook name |
pkgname |
character string: the package/namespace name |
event |
character string: an event for the package. Can be abbreviated. |
value |
A function or a list of functions, or for action = "replace", NULL |
action |
The action to be taken. Can be abbreviated. |
# NOT RUN {
setHook(packageEvent("grDevices", "onLoad"),
function(...) grDevices::ps.options(horizontal = FALSE))
# }