R/OutcomeDist.R

######################################################################################################################

# Function: OutcomeDist.
# Argument: Outcome Distribution and Outcome Type
# Description: This function is used to create an object of class Outcome.
#' @export
OutcomeDist = function(outcome.dist, outcome.type = NULL) {

  # Error checks
  if (!is.character(outcome.dist)) stop("Outcome: outcome distribution must be character.")
  if (!is.null(outcome.type)) {
    if (!is.character(unlist(outcome.type))) stop("Outcome: outcome must be character.")
    if(!all((unlist(outcome.type) %in% c("event","standard")))==TRUE) stop("Outcome: outcome type must be event or standard")
  }

  outcome = list(outcome.dist = outcome.dist,
                 outcome.type = outcome.type)

  class(outcome) = "OutcomeDist"
  return(outcome)
  invisible(outcome)

}

Try the Mediana package in your browser

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

Mediana documentation built on May 8, 2019, 5:04 p.m.