.onAttach <- function(...) {
to_load <- c("admisc", "declared")
# code borrowed from package tidyverse
# Attach the package from the same package library it was
# loaded from before. https://github.com/tidyverse/tidyverse/issues/171
load_library <- function(pkg) {
if (pkg %in% loadedNamespaces() && !is.element(pkg, .packages())) {
loc <- dirname(getNamespaceInfo(pkg, "path"))
do.call(
"library",
list(pkg, lib.loc = loc, character.only = TRUE, warn.conflicts = FALSE)
)
}
}
not_yet_loaded <- to_load[!is.element(paste0("package:", to_load), search())]
if (length(not_yet_loaded) > 0) {
packageStartupMessage(
paste("Also attaching packages:", paste(not_yet_loaded, collapse = ", "))
)
suppressPackageStartupMessages(
lapply(not_yet_loaded, load_library)
)
}
return(invisible())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.