colname: Change Selected Names

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Change selected element names.

Usage

1
colname(x) <- value

Arguments

x

an object with named elements

value

named character vector

Details

Changing column names is a common task. One can change them all at once, e.g.

colnames(x) <- c(...)

names(x) <- c(...)

or one at a time, e.g.

names(x)[names(x)==old] <- new

reshape supplies rename, a function that changes a subset of identified names, returning the object itself.

library(reshape)

x <- rename(x, c(label=value,...))

In contrast, name and its data frame equivalent colname change a subset of identified names using assignment syntax.

name(x) <- c(label=value,...)

Value

used for side effects

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

1
2
3
4
5
6
7
8
9
names(Theoph)
name(Theoph) <- c(Subject='SUBJECT')
names(Theoph)
colname(Theoph) <- c(SUBJECT='subject',conc='concentration')
names(Theoph)
names(letters) <- LETTERS
letters
name(letters) <- c(A='a',B='b',C='c')
letters

anniejw6/metrumrg documentation built on May 10, 2019, 11:50 a.m.