units                 package:Hmisc                 R Documentation

_U_n_i_t_s _A_t_t_r_i_b_u_t_e _o_f _a _V_e_c_t_o_r

_D_e_s_c_r_i_p_t_i_o_n:

     Sets or retrieves the '"units"' attribute of an object. For
     'units.default' replaces the builtin version, which only works for
     time series objects.  If the variable is also given a 'label',
     subsetting (using '[.labelled') will retain the '"units"'
     attribute.  For S-Plus 6 which uses version 4 of the S language,
     the latter does not work.

_U_s_a_g_e:

     units(x, ...)
     ## Default S3 method:
     units(x, none='', ...)
     units(x) <- value

_A_r_g_u_m_e_n_t_s:

       x: any object

     ...: ignored

   value: the units of the object, or ""

    none: value to which to set result if no appropriate attribute is
          found

_V_a_l_u_e:

     the units attribute of x, if any; otherwise, the 'units' attribute
     of the 'tspar' attribute of 'x' if any; otherwise the value 'none'

_S_e_e _A_l_s_o:

     'label'

_E_x_a_m_p_l_e_s:

     fail.time <- c(10,20)
     units(fail.time) <- "Day"
     describe(fail.time)
     label(fail.time) <- 'Failure Time'
     fail.time
     ## Not run: 
     f <- cph(Surv(fail.time, event) ~ xx)
     plot(xx,xx2,xlab=paste(label(xx),", ",units(xx),"s",sep=""))
     ## End(Not run)

