% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data-menu.R
\name{RecodeDialog}
\alias{RecodeDialog}
\title{Rcmdr Recode Dialog}
\usage{
RecodeDialog()
}
\description{
Rcmdr Recode Dialog
}
\details{
Recode numeric variables and factors into factors.

The recode dialog is normally used to recode numeric variables and factors into factors, for example by combining values of numeric variables or levels of factors.
It may also be used to produce new numeric variables.
The Rcmdr recode dialog is based on the \code{\link[car:recode]{Recode}} function in the \code{car} package.

The name of each new variable must be a valid R object name (consisting only of upper and lower-case letters, numerals, and periods, and not starting with a numeral).

Enter recode directives in the box near the bottom of the dialog.
Directives are normally entered one per line, but may also be separated by semicolons.
Each directive is of the form \code{input = output} (see the examples below).
If an input value satisfies more than one specification, then the first (from top to bottom, and left to right) applies.
If no specification is satisfied, then the input value is carried over to the result.
\code{NA} is allowed on input and output.
Factor levels are enclosed in double-quotes on both input and output.

Several recode specifications are supported:
\describe{
   \item{a single value}{For example, \code{"missing" = NA}.}
   \item{several values separated by commas}{For example, \code{7,8,9 = "high"}.}
   \item{a range of values indicated by a colon}{For example, \code{7:9 = "high"}.
      The special values \code{lo} and \code{hi} may appear in a range.
      For example, \code{lo:10=1}.
      Note that these values are unquoted.}
   \item{the special value \code{else}}{everything that does not fit a previous specification.
      For example, \code{else=NA}.
      Note that \code{else} matches \emph{all} otherwise unspecified values on input, including \code{NA}.}
}

If all of the output values are numeric, and the "Make new variable a factor" check box is unchecked, then a numeric result is returned.

If several variables are selected for recoding, then each is recoded using the same recode directives.
In this case, the name entered in the box labelled "New variable name or prefix for multiple recodes" will be prefixed to the name of each variable being recoded.
Setting an empty prefix (i.e., "") will cause the recoded variables to replace the original variables.

As explained, \code{=} is used to separate old from new values, and \code{:} is used to specify an interval (or range) of numeric values.
It is possible to change these operators to other character strings, such as \code{->} and \code{~} (tilde).
This may be necessary, for example, if a factor to be recoded has \code{=}s or \code{:}s in its level (category) names.

Similarly, the dialog generates a call to the \code{\link[car]{Recode}} function in the \pkg{car} package, which by default uses \code{;} to separate recode specifications.
The recode separator can also be changed, for example, to \code{/}.
}
\seealso{
\code{\link[car]{Recode}}
}
\author{
John Fox
}
\keyword{manip}
