R/draw_names.R

Defines functions draw_names

Documented in draw_names

#' Draw the evolution of the occurences of different names
#'
#' @param names the names you want to observe
#'@import dplyr tidyr ggplot2 prenoms
#' @return a ggplot graph.
#' @export
#'
#' @examples
#' \dontrun{
#' draw_names(c("Sacha","Hugo",...))
#' }
draw_names <- function(names){
  assert_that(is.character(class(names)))
  data("prenomDB")
  prenomsDB %>% filter(name %in% names) %>%
    group_by(year,name) %>%
    summarize(count=n()) %>%
    ggplot(aes(x=year, y=count,color=name))+ geom_line()
}
SachaIZADI/R-for-datascience-Package-Training documentation built on May 28, 2019, 3:14 p.m.