Learn R Programming

translateSPSS2R (version 1.0.0)

xpssRenameVariables: Renaming Variables

Description

R implementation of the SPSS RENAME VARIABLES function. xpssRenameVariables renames variables within an exisiting data.frame or xpssFrame object.

Usage

xpssRenameVariables(x, oldVarNames = NULL, newVarNames = NULL)

Arguments

x
a (non-empty) data.frame or input data of class "xpssFrame".
oldVarNames
atomic character or character vector with the names of the variables to rename. oldVarNames must be a variable that already exists in the data set.
newVarNames
atomic character or character vector with the new variable names.

Value

Returns the data with the renamed variables.

Details

Modifies names of one or more variables within a selected dataset. The arguments oldVarNames and newVarNames must have the same length.

Examples

Run this code
data(fromXPSS)

xpssRenameVariables(fromXPSS,
oldVarNames= c("V1", "V2", "V3"),
newVarNames= c("Manufacturer", " Car Type", "Country"))

Run the code above in your browser using DataLab