This help topic is for R version 1.3. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/names.html
names {base}R Documentation

The Names Attribute of an Object

Description

Functions to get or set the names of an object.

Usage

names(x, ...)
names(x) <- value

Arguments

x

an R object.

value

a character vector of the same length as x, or NULL.

Value

For names, NULL or a character vector of the same length as x.

For names<-, the updated object. (Note that the value of names(x) <- value is that of the assignment, value, not the return value from the left-hand side.)

Examples


# print the names attribute of the islands data set
names(islands)

# remove the names attribute
names(islands) <- NULL

z <- list(a=1, b="c", c=1:3)
names(z)
# change just the name of the third element.
names(z)[3] <- "c2"
z

[Package base version 1.3 ]