#' Saves ggplots
#'
#' @param p plot
#' @param name name of plot
#' @param res resolution
#'
#' @return
#' @export
#'
#' @importFrom ggplot2 ggsave
#'
save.ggplot <- function(p, name, res = 300) {
if(!dir.exists("plots")) {
dir.create("plots")
}
if(!hasArg(name)) {
name <- readline("Name: ")
}
ggplot2::ggsave(paste0("./plots/", name, ".png"),
plot = p,
dpi = res)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.