R/new_fun.R

Defines functions print.another_new_class new_fun

Documented in new_fun

#' Title
#'
#' @return Prints your message in magenta
#'
#' @param msg Input that should be printed in magenta.
#'
#' @export
#'
#' @examples
#' new_fun("hello")
new_fun <- function(msg) {
  structure(msg, class = "another_new_class")
}

#' @export
print.another_new_class <- function(x, ...) {
  cat(crayon::magenta(x))
  invisible(x)
}
TSchiefer/r.pkg documentation built on Feb. 25, 2022, 12:28 p.m.