R/units.s

Defines functions units.Surv units.default units

Documented in units units.default units.Surv

units <- function(x, ...)
  UseMethod("units")

"units<-.default"  <- function(x, value)
{
  attr(x, "units") <- value
  x
}

units.default <- function(x, none='', ...)
{
  lab <- attr(x, "units")
  if(is.null(lab))
    lab <- attr(attr(x,'tspar'),'units')

  if(is.null(lab))
    lab <- none

  lab
}


units.Surv <- function(x, none='', ...)
{
  at  <- attributes(x)
  un  <- at$units
  ia  <- at$inputAttributes
  if(! length(un) && length(ia)) {
    un <- ia$time2$units
    if(! length(un)) un <- ia$time$units
  }
  if(! length(un)) un <- none
  un
}
harrelfe/Hmisc documentation built on Oct. 3, 2019, 9:34 p.m.