BSkyRecode: Recode variables

BSkyRecodeR Documentation

Recode variables

Description

Recodes one or more a numeric vector, character vector, or factors according to recode specifications. You can store the results by overwriting existing variables, specifying new variable names to store recoded values or choosing to store the recoded values in new variables with a suitable prefix or suffix. the prefix or suffix will be applied to the existing variable name. Note: We will not convert from numeric to factor. When a numeric is recoded, it will remain a numeric, when a factor variable is recoded it will remain a factor.

Usage

BSkyRecode(
  colNames,
  newColNames = "",
  OldNewVals,
  NewCol = FALSE,
  prefixOrSuffix = "",
  prefixOrSuffixString = "",
  makeNumeric = FALSE,
  dontMakeFactor = FALSE,
  dataSetNameOrIndex
)

Arguments

colNames

A character vector containing one or more variables in the dataset to recode

newColNames

A character vector containing the names of the new columns.

OldNewVals

A character string of recode specifications in the form oldval1,newval1, oldval2,newval2

NewCol

A Boolean indicating whether recoded values are stored in new variables (TRUE) or existing variables are overwritten(FALSE).

prefixOrSuffix

Specify if you want to store the recoded values in new variables prefixed or suffixed with the name you specify. Enter prefix or suffix.

prefixOrSuffixString

Enter a string to use as a prefix or suffix to the existing variable name. Recoded values will be stored in these variables.

dataSetNameOrIndex

The dataset/dataframe name


BlueSkyStatistics/BlueSky documentation built on April 14, 2025, 7:39 a.m.