#' Density Plot
#'
#' @param v numerical vector
#'
#' @return a ggplot
#' @export
#'
#' @examples density_plot(rnorm(50))
#' @importFrom magrittr %>%
#' @importFrom ggplot2 ggplot aes geom_density
density_plot <- function(v) {
# if(!requireNamespace("ggplot2", quietly = T)){
# stop("Need ggplot2!")
# }
ggplot(data.frame(values = v),
aes(x = values)) +
geom_density()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.