Learn R Programming

SASxport (version 1.2.0)

label: Set or Retreive the 'label', 'SASformat', or 'SASiformat' Attribute of a Vector

Description

Sets or retrieves the "label", "SASformat", or "SASiformat" attribute of an object.

More comprehensive support for object labels, and SASformat, are available in Frank Harrell's Hmisc package.

Usage

label(x, default)
label(x) <- value

SASformat(x, default) SASformat(x) <- value

SASiformat(x, default) SASiformat(x) <- value

Arguments

x
any object
value
new value for the "label", "SASformat", or "SASiformat" attribute of an object.
default
value to return when no appropriate attribute is found. The usual return value is NULL.

Value

  • the contents of the "label", "SASformat", or "SASiformat" attribute of x, if any; otherwise, the value provided by default.

Examples

Run this code
fail.time <- c(10,20)

# set attributes
label(fail.time) <- 'Failure Time'
SASformat(fail.time) <- 'Numeric2'
SASiformat(fail.time) <- 'Numeric2'

# display individual attributes
label(fail.time)
SASformat(fail.time)
SASiformat(fail.time)

# display all attributes
attributes(fail.time)

# Example showing specification of default return value
a <- 70
label(a, default="no label")


# for a nice display
library(Hmisc)
describe(fail.time)

f <- cph(Surv(fail.time, event) ~ xx)
plot(xx,xx2,xlab=label(xx),"s",sep=""))

Run the code above in your browser using DataLab