check_for_package <- function(pkg, os) {
if (.Platform["OS.type"] == os) {
if (!requireNamespace(pkg, quietly = T)) {
install.packages(pkg)
message(paste("installing", pkg, "package", sep = " "))
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.