Get or set specific attributes of an object.
an object whose attributes are to be accessed.
a non-empty character string specifying which attribute is to be accessed.
an object, the new value of the attribute, or
These functions provide access to a single attribute of an object. The replacement form causes the named attribute to take the value specified (or create a new attribute with the value given).
The extraction function first looks for an exact match to
amongst the attributes of
x, then (unless
exact = TRUE)
a unique partial match.
options(warnPartialMatchAttr = TRUE) causes
partial matches to give warnings.)
The replacement function only uses exact matches.
Note that some attributes (namely
tsp) are treated specially and have restrictions on
the values which can be set. (Note that this is not true of
levels which should be set for factors via the
levels replacement function.)
The extractor function allows (and does not match) empty and missing
which: the replacement function does not.
NULL objects cannot have attributes and attempting to
assign one by
attr gives an error.
Both are primitive functions.
For the extractor, the value of the attribute matched, or
if no exact match is found and no or more than one partial match is found.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.