R/add_class.R

Defines functions add_class

Documented in add_class

#' Add A New Class
#'
#' @param x An object.
#' @param define_class A new self-defined class
#' @export
#'
#' @examples
#' a <- matrix(rnorm(1000), nrow = 100)
#' a <- add_class(a, 'my_matrix')
add_class <- function(x, define_class){
  base::class(x) <- c(base::class(x), define_class)
  x
}
duohongrui/simutils documentation built on March 12, 2024, 8:40 p.m.