R/zoo.R

Defines functions zoo

Documented in zoo

#' Random Animals
#'
#' This function returns random animals emojis.
#'
#' @param size a non-negative integer giving the number of items to choose.
#' @param replace should sampling be with replacement? Defaults to `FALSE`.
#'
#' @return Character vector of animal emojis.
#' @export
#'
#' @examples
#' set.seed(1234)
#'
#' zoo(1)
#'
#' zoo(10)
zoo <- function(size, replace = FALSE) {
  not_animals <- c("feather", "spider web", "pig nose", "paw prints")

  animals <- emoji::emojis[grep("animal", emoji::emojis$subgroup), ]
  animals <- animals[animals$qualified == "fully-qualified", ]
  animals <- animals[!animals$name %in% not_animals, ]
  animals <- animals[!grepl("face", animals$name), ]

  sample(animals$emoji, size = size, replace = replace)
}

Try the emoji package in your browser

Any scripts or data that you put into this service are public.

emoji documentation built on Oct. 30, 2024, 9:28 a.m.