Learn R Programming

pmmlTransformations (version 1.3.3)

RenameVar: Renames a variable in the WrapData transform object

Description

Renames a variable inside a WrapData object

Usage

RenameVar(boxdata, xformInfo=NA, ...)

Arguments

boxdata

wrapper object obtained by using the WrapData function on the raw data.

xformInfo

specification of details of the renaming.

further arguments passed to or from other methods.

Value

R object containing the raw data, the transformed data and data statistics.

Details

Once input data is wrapped by the WrapData function, it is somewhat involved to rename a variable inside. This function makes it easier to do so. Given an variable named InputVar and the name one wishes to rename it to, OutputVar, the rename command options are:

xformInfo="InputVar -> OutputVar"

There are two methods in which the variables can be referred to. The first method is to use its column number; given the data attribute of the boxData object, this would be the order at which the variable appears. This can be indicated in the format "column#". The second method is to refer to the variable by its name. This method will work even if the renamed value already exists; in which case there will be two variables with the same name.

If no input variable name is provided, the original object is returned with no renamings performed.

See Also

WrapData.

Examples

Run this code
# NOT RUN {
# Load the standard iris dataset, already built into R
   data(iris)

# First wrap the data
   irisBox <- WrapData(iris)

# We wish to refer to the variables "Sepal.Length" and 
# "Sepal.Width" as "SL" and "SW"
  irisBox <- RenameVar(irisBox,"column1->SL")
  irisBox <- RenameVar(irisBox,"Sepal.Width->SW")

# }

Run the code above in your browser using DataLab