labels
Labels for Printing

### Description

Returns a vector of character strings or some other object which can be used to label the object.
This function is generic (see Methods); method functions can be written to handle specific classes of data. Classes that already have methods for labels are dist, lm, glm, terms, and the default method is intended to deal with various simple classes of data.

### Usage

    labels(object, ...)

    ## Default S3 method:
    labels(object, ...)
    ## S3 method for class 'dendrogram':
    labels(object, ...)
    ## S3 method for class 'dist':
    labels(object, ...)
    ## S3 method for class 'lm':
    labels(object, ...)
    ## S3 method for class 'glm':
    labels(object, ...)
    ## S3 method for class 'terms':
    labels(object, ...)

### Arguments

object | an object of fitted model, for which a printing or plotting method, or similar function, is to be called.
... | additional arguments to be passed to or from future functions.

Value
returns a character vector or other suitable structure containing the necessary character strings for labeling the data in object. Labels returned by labels are suitable for labeling individual elements, columns, and so on, in printed output. The labels of an object depend very much on the class of the object:

- for a vector with names, they are the names.
- for a multidimensional object, the dimnames (names for rows, columns, and so on).
- for a terms object, the names of the terms.
- for an lm or glm object, the names of the estimable terms.
- for a dist object, the row names of the matrix from which the distance structure was formed.

In each case, if no suitable labels are found in an object then default labels are created.
References
Chambers, J. M. and Hastie, T .J. (Eds.) 1992. Statistical Models in S. Pacific Grove, CA: Wadsworth & Brooks/Cole.
See Also
print.
Examples

    x <- c(a=11, b=22, c=33)
    cat("Results were:\n", paste(labels(x), "=", x), "\n")
    ## Results were:
    ##  a = 11 b = 22 c = 33
    d <- data.frame(Big=factor((1:20) > 12), Small=factor((1:20) < 8), Y=1:20)
    labels(d)
    ## [[1]]
    ##  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" "15"
    ## [16] "16" "17" "18" "19" "20"
    ##
    ## [[2]]
    ## [1] "Big"   "Small" "Y"
    labels(terms(Y ~ Big * Small))  # names of expanded terms
    ## [1] "Big"       "Small"     "Big:Small"
    labels(lm(Y ~ Big * Small, data=d))  # omits interaction term: coef was NA
    ## [1] "Big"   "Small"
    ff.dist <- dist(Sdatasets::fuel.frame[,1:4])
    labels(ff.dist)  # same as rownames of input to dist()
    ##  [1] "Eagle Summit 4"                "Ford Escort 4"
    ##  [3] "Ford Festiva 4"                "Honda Civic 4"
    ##  [5] "Mazda Protege 4"               "Mercury Tracer 4"
    ##     .
    ##     .
    ##     .
    ## [59] "Nissan Axxess 4"               "Nissan Van 4"
    labels(c(1.1, 1.4, 2.0))  # creates labels c("1", "2", "3")

Package base version 6.1.5-18
Package Index