R/cat_name.R

Defines functions cat_name

Documented in cat_name

#' Get cats by name
#'
#' @param df A dataset with column name
#' @param text Partial name of a cat
#' @return The names of cats in descending popularity
#' @example
#'    cat_name(cats, "nut")
#' @export

cat_name <- function(df, text="nut"){

library(tidyverse)

df %>%
  filter(grepl(text, name)) %>%
  group_by(name) %>%
  tally() %>%
  arrange(-n)

}
jalapic/qwerty documentation built on May 24, 2019, 4:09 p.m.