makeind: Build x matrix from x data frame (convert factors to dummies)
Description
Converts factors to dummies.
Note that with more than one level, BART needs a dummy for each level of a factor
(unlike in linear regression where one of the dummies is dropped).
Usage
makeind(
x,
all=TRUE)
Value
A matrix.
Numerical variables come first, and then the appended dummies.
Arguments
x
Data frame of explanatory variables.
all
If all=TRUE, a factor with p levels will be replaced by all p dummies.
If all=FALSE, the pth dummy is dropped.
Uses function class.ind from the nnet library.
Note that if you have train and test data frames, it may be best
to rbind the two together, apply makeind to the result, and then pull them back apart.