File: units.s

package info (click to toggle)
hmisc 5.2-5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,044 kB
  • sloc: asm: 28,907; f90: 590; ansic: 415; xml: 160; fortran: 75; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 600 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
units <- function(x, ...)
  UseMethod("units")

"units<-.default"  <- function(x, value)
{
  # value <- sub('s$', '', tolower(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
}