character vector specifying the row or column names of a dataset.
rowcol.spec
integer vector specifying the indices into
existing.names where new, unique
names will be generated.
OPTIONAL ARGUMENTS:
new.names
character vector specifying the (possibly non-unique) names that are to replace
the
rowcol.spec elements of
existing.names. If necessary, it will be
extended to
length(rowcol.spec) using default values of (if
which="rows")
"n" or (if
which="columns")
"Vn", where
n is the corresponding element
of rowcol.spec.
which
character value, either "columns" (the default) or "rows", specifying whether to
generate column or row names.
VALUE:
If
length(existing.names) is 0,
existing.names; otherwise, character vector
of length
length(rowcol.spec) and values
new.names, possibly modified (in a
way such that any value, which is not unique in a vector of
existing.names
with its
rowcol.spec elements replaced by
new.names, will have a
".n"
appended, with
n being the smallest integer greater than 0 such that the value
is unique).
SEE ALSO:
,
,
.
EXAMPLES:
# gives "gender", as no other columns (besides 2) of drug.mult have that name
unique.rowcol.names(name.cols(drug.mult), 2, "gender")
# gives c("Y.1", "Y.5"), as the two "Y" new.names are non-unique and the
# remaining names (besides 2:3) of drug.mult are c("Y.2", "Y.3", "Y.4")
unique.rowcol.names(name.cols(drug.mult), 2:3, rep("Y",2))
# gives c("V4", "V5"), the default for column names
unique.rowcol.names(name.cols(longley.x), 4:5)
# gives c("4", "5"), the default for row names
unique.rowcol.names(name.rows(longley.x), 4:5, which="rows")