require_package <- function(pkg){
if(!requireNamespace(pkg, quietly = TRUE)){
rlang::abort(
sprintf('The `%s` package must be installed to use this functionality. It can be installed with install.packages("%s")', pkg, pkg)
)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.