#' draw_a_name
#'
#' Draw graph for a given name based on the prenoms data
#' @param the_name Person name to be graphed
#' @param the_sex Gender of the name
#' @return graph for queried parameters
#' @import assertthat
#' @import dplyr
#' @import tidyr
#' @import dygraphs
#' @import prenoms
#' @examples
#' draw_a_name("Dana", "F")
#' @export
draw_a_name <- function(the_name, the_sex) {
assert_that(is.character(the_name))
assert_that(the_sex == "F" || the_sex == "M")
prenoms %>%
group_by(year,name,sex) %>%
summarise(total = sum(n)) %>%
filter(name == the_name, sex == the_sex) %>%
spread(key = name, value = total) %>%
dygraph()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.