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, and generally the class, are 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. The class is usually changed to "structure", although some attributes (for example, "dim" and "levels" ) result in other classes (such as "array" or "matrix" , and "category" ).

In some cases attributes are mutually exclusive; for example, assigning names (a "names" attribute) to a matrix or array currently erases "dim" and "dimnames" attributes and changes a matrix or array to a vector with class "named".

If value has length 0, all attributes are deleted.

DETAILS:

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:

, , , .

For attributes known to S-PLUS, see the documentation for , , , , and .

EXAMPLES:

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