R/occasions.R

#_______________________________________________________________________________
#----                           occasions class                             ----
#_______________________________________________________________________________

#'
#' Occasions class.
#'
#' @export
setClass(
  "occasions",
  representation(),
  contains = "pmx_list",
  prototype = prototype(type = "occasion")
)

#_______________________________________________________________________________
#----                            get_names                                   ----
#_______________________________________________________________________________

setMethod("get_names", signature = c("occasions"), definition = function(object) {
  return(object@list %>% purrr::map_chr(.f = ~ .x@colname))
})

#_______________________________________________________________________________
#----                                  show                                 ----
#_______________________________________________________________________________

setMethod("show", signature = c("occasions"), definition = function(object) {
  if (object %>% length() > 0) {
    cat("-> Treatment occasions:", paste0(object %>% get_names(), collapse = ","))
    cat("\n")
  }
})

Try the campsis package in your browser

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

campsis documentation built on Aug. 5, 2026, 9:07 a.m.