All Attributes of an Object

DESCRIPTION:
Returns or changes all of the attributes of an object. Attributes specify the characteristics of any data object.

USAGE:
attributes(x)
attributes(x) <- value

REQUIRED ARGUMENTS:
x:
any object.

OPTIONAL ARGUMENTS:
value:
a recursive object, typically a list.

VALUE:
a list of all the attributes of x. names(attributes(x)) is the vector of the names of the attributes.

The replacement form returns value.


SIDE EFFECTS:
the attributes of x will be changed as a result of the assignment version of this function. The attributes of x are set to the corresponding components of value and old attributes of x are deleted. If value has length 0, all attributes are deleted.

DETAILS:
This is a generic function; currently there are no methods for it.

Every data object receives two attributes ("length" and "mode") simply by being defined. "Length" specifies the number of values in the object and "mode" returns the type of object (eg. "numeric", "list", "logical", "NULL"). "Length" and "mode" are implicit attributes. However, the attributes function does not return any information on implicit attributes. Use length(x) and mode(x) to retrieve information on implicit attributes.

Other attributes may define various data types in the object ("dim") or store labels for data in the object ("dimnames" or "names"). This information will be returned by the attributes function.


SEE ALSO:
attr , structure , length , mode .

For attributes known to S-PLUS, see the documentation for class, dim, dimnames, levels, names and tsp.


EXAMPLES:
names(attributes(testscores))   # names of attributes of testscores
attributes(testscores)

attributes(foo) <- list(dim = c(2,4)) # coerces foo to a matrix