% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/SelectVar.R
\name{SelectVar}
\alias{SelectVar}
\title{This function preprocess the data for the Optimal Trees function.}
\usage{
SelectVar(
  formula = NULL,
  data,
  Names = NULL,
  YSelected = NULL,
  XSelected = NULL,
  map = NULL,
  original = NULL,
  round = NULL,
  discretize = NULL,
  verbose = TRUE
)
}
\arguments{
\item{formula}{a description of the model to be fit. The format is \code{Y1 + \dots + Yn ~  X1 + \dots + Xn},
where the variable before ~ represents the dependent variables and the variables after
the ~ are the independent variables.}

\item{data}{Dataset to be analyzed. If data contains ordinal variables, order the factor levels
before using this function. Otherwise, the factors will be ordered alphabetically and the results will not be correct.}

\item{Names}{names of the variables in the data. If empty, it uses the column names of Data}

\item{YSelected}{index corresponding to the first Selected column.}

\item{XSelected}{Indices corresponding to the selected columns that will form X}

\item{map}{[ori vars] sets for each variable whether the tree will depict
thresholds based upon original values (var number), or recoded values (0).}

\item{original}{[TRUE/FALSE] sets for each variable whether the tree will depict
thresholds based upon original values (true), or recoded values (false).}

\item{round}{[factors] autorecoding based upon rounded categories; the categories will
be round after multiplying with the factor, and divided by the
factor after rounding. Set round=0 for variables that are not
rounded (e.g. discretized variables).}

\item{discretize}{[ncat] optimal discretization while minimizing SS within
a group, set ncat=0 for each variable that is to
be left unaltered}

\item{verbose}{logical, if TRUE, prints information about the progress of the algorithm.}
}
\value{
Returns the following 3 elements:
 \item{Y}{dataset containing the Y variables.}
 \item{X}{dataset containing the X variables.}
 \item{Desc}{List containing the variable names and their corresponding cutting points.}
}
\description{
This function preprocess the data for the Optimal Trees function.
}
\details{
The function selects the Y and X variables according to the inputs and also returns
Desc, a list containing variable cutting points and variable names. These 3 elements are
required by the OptimalTrees function.
}
\examples{
data(mtcars)
dataSelection<-SelectVar( mpg ~ cyl + hp + wt, data = mtcars, discretize= c(0, 10, 10))

}
\seealso{
\code{\link{summary.ETree}}, \code{\link{ETree}},
  \code{\link{plot.ETree}}, \code{\link{predict.ETree}}
}
\keyword{exact}
\keyword{tree}
