Names Attribute of an Object

DESCRIPTION:
Returns or changes the names attribute of an object, usually a list or a vector.

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

REQUIRED ARGUMENTS:
x:
any object.

OPTIONAL ARGUMENTS:
value:
vector of character strings. This must have the same length as x.

VALUE:
if x has a names attribute then this attribute is returned; otherwise NULL. The names attribute can be used for subset and element selection. It is a character vector of the same length as x.

SIDE EFFECTS:
On the left side of an assignment, the names attribute of x is set to value, which must have the same length as x. To explicitly delete the names attribute, use names(x) <- NULL.

DETAILS:
This is a generic function, you may create methods for both the names function and the assignment version ("names<-") for specific classes of objects.

Use "" in value for the objects in x that do not have names.


NOTE:
See as.name for objects of mode "name".

SEE ALSO:
attributes , dimnames , as.name , Subscript .

EXAMPLES:
x.name <- x[names(x)!=""]
        # find the elements of x with non-null names

ozone.xy[["x"]] # alternative to ozone.xy$x