R/zzz.R

Defines functions print.trendy

Documented in print.trendy

#' Create print method for trendy object
#' @name trendy
#' @param x trendy object
#' @importFrom dplyr pull group_by summarise
#' @export
print.trendy <- function(x, ...) {
  cat((crayon::bold("~Trendy results~\n")))
  cat("\nSearch Terms: ")
  cat(paste(get_interest(x) %>%
              dplyr::pull(keyword) %>%
              unique(),
            sep = " "), sep = ", ")
  cat("\n\n(>^.^)> ~~~~~~~~~~~~~~~~~~~~ summary ~~~~~~~~~~~~~~~~~~~~ <(^.^<)\n")
  print(x %>%
          get_interest() %>%
          group_by(keyword) %>%
          summarise(max_hits = max(hits),
                    min_hits = min(hits),
                    from = as.Date(min(date)),
                    to = as.Date(max(date))))
  invisible(x)
}

Try the trendyy package in your browser

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

trendyy documentation built on May 20, 2019, 5 p.m.