# NOT RUN {
# Load the standard iris dataset, already available in R
data(iris)
# First wrap the data
iris_box <- xform_wrap(iris)
# Discretize the "Species" variable. This will find all possible
# values of the "Species" variable and define new variables. The
# parameter name used here should be replaced by the new preferred
# parameter name as shown in the next example below.
#
# "Species_setosa" such that it is 1 if
# "Species" equals "setosa", else 0;
# "Species_versicolor" such that it is 1 if
# "Species" equals "versicolor", else 0;
# "Species_virginica" such that it is 1 if
# "Species" equals "virginica", else 0
iris_box <- xform_norm_discrete(iris_box, input_var = "Species")
# Exact same operation performed with a different parameter name.
# Use of this new parameter is the preferred method as the previous
# parameter will be deprecated soon.
iris_box <- xform_wrap(iris)
iris_box <- xform_norm_discrete(iris_box, xform_info = "Species")
# }
Run the code above in your browser using DataLab