#' density_plot_function
#'
#' @param df : a data frame
#' @param variable_name : name of variable to create density.
#'
#' @return FALSE if no variable name is passed, and TRUE if plot successfully builds.
#' @export
#'
#' @examples
#'
#' example_df <- data.frame(X=1:100)
#' density_plot_function(example_df, 'X')
#'
density_plot_function <- function(df, variable_name){
if(length(variable_name)==0){
message("Need to pass in a variable name.")
return(F)
}
plot(density(df[[variable_name[1]]]), main=paste0("Density Plot for ", variable_name[1]))
return(T)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.