Turns ordered variables into integers and expands factors as binary dummy
codes. cont_conv()
additionally adds noise to discrete variables, but this is only
useful for estimation. [cc_prepare()]
can be used to evaluate an already
fitted estimate.
expand_as_numeric(x)
x | a vector or data frame with numeric, ordered, or factor columns. |
---|
A numeric matrix containing the expanded variables. It has additional
type expanded_as_numeric
and attr(, "i_disc")
cntains the indices of
discrete variables.
# dummy data with discrete variables dat <- data.frame( F1 = factor(rbinom(100, 4, 0.1), 0:4), Z1 = as.ordered(rbinom(100, 5, 0.5)), Z2 = as.ordered(rpois(100, 1)), X1 = rnorm(100), X2 = rexp(100) ) pairs(dat)pairs(expand_as_numeric(dat)) # expanded variables without noise