rename.cols: Replace/rename a column in an object

Description Usage Arguments Value Examples

View source: R/rename.R

Description

Essentially a thin convenience wrapper around plyr::rename(x, list(...)), except qtag objects have their id.vars/tag.vars/measure.vars attributes properly modified.

Usage

1
2
3
4
5
6
7
8
9
rename.cols(.data, ..., warn_missing = TRUE, warn_duplicated = TRUE)

## Default S3 method:
rename.cols(.data, ..., warn_missing = TRUE,
  warn_duplicated = TRUE)

## S3 method for class 'qtag'
rename.cols(.data, ..., warn_missing = TRUE,
  warn_duplicated = TRUE)

Arguments

.data

An object that has columns that can be renamed

...

Key/value pairs to replace in the form oldval="newval"

warn_missing

Print a message if any old names are not actually present in x

warn_duplicated

Print a message if any name appears more than once in x after the operation.

Value

A copy of the modified object

Examples

1
2
3
4
5
data(pocmaj)
rename.cols(pocmaj, Ca="Calcium")
pocmaj2 <- as.qtag(pocmaj, id.vars=c("core", "depth"))
pocmaj2 <- rename.cols(pocmaj2, Ca="Calcium")
attr(pocmaj2, "measure.vars")

mudata documentation built on Nov. 17, 2017, 7:30 a.m.