preprocess_df {SoftBart} | R Documentation |
Preprocess a dataset for use with SoftBart
Description
Preprocesses a data frame for use with softbart
; not needed with other
model fitting functions, but may also be useful when designing custom methods
with MakeForest
. Returns a data matrix X that will work with
categorical predictors, and a vector of group indicators; this is required to
get sensible variable selection for categorical variables, and should be
passed in as the group argument to Hypers
.
Usage
preprocess_df(X)
Arguments
X |
A data frame, possibly containing categorical variables stored as factors. |
Value
A list containing two elements.
-
X
: a matrix consisting of the columns of the input data frame, with separate columns for the different levels of categorical variables. -
group
: a vector of group memberships of the predictors inX
, to be passed as an argument toHypers
.
Examples
data(iris)
preprocess_df(iris)
[Package SoftBart version 1.0.1 Index]