rename: Rename columns in an Xdf file

Description Usage Arguments Details Value See Also Examples

Description

Rename columns in an Xdf file

Usage

1
2
3
4
5
## S3 method for class 'RxFileData'
rename(.data, ..., .outFile = tbl_xdf(.data), .rxArgs)

## S3 method for class 'RxDataSource'
rename(.data, ...)

Arguments

.data

A data source.

...

Key-value pairs of unquoted variables to rename, in new = old format.

.outFile

Output format for the returned data. If not supplied, create an xdf tbl; if NULL, return a data frame; if a character string naming a file, save an Xdf file at that location.

.rxArgs

A list of RevoScaleR arguments. See rxArgs for details.

Details

Renaming is generally a very fast operation, as only the metadata in the Xdf file header is changed. The exception is when the dataset needs to be copied, either to preserve dplyrXdf's semantics of never modifying the source data for a pipeline, or if the the desired output format is a data frame or persistent Xdf file. If a copy is made, rxDataStep is used and will accept arguments supplied in .rxArgs.

Value

An object representing the transformed data. This depends on the .outFile argument: if missing, it will be an xdf tbl object; if NULL, a data frame; and if a filename, an Xdf data source referencing a file saved to that location.

See Also

rename in package dplyr

Examples

1
2
3
4
5
6
mtx <- as_xdf(mtcars, overwrite=TRUE)
tbl <- rename(mtx, mpg2=mpg, cyl2=cyl)
names(tbl)

# save to a persistent Xdf file
rename(mtx, mpg2=mpg, .outFile="mtcars_renamed.xdf")

RevolutionAnalytics/dplyrXdf documentation built on June 3, 2019, 9:08 p.m.