Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

mudata (version 0.1.1)

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

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

rename.cols(.data, ..., warn_missing = TRUE, warn_duplicated = TRUE)

# S3 method for default rename.cols(.data, ..., warn_missing = TRUE, warn_duplicated = TRUE)

# S3 method for 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

Run this code
# NOT RUN {
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")

# }

Run the code above in your browser using DataLab