I am using Arthritis
data set from vcd
package to perform one hot encoding. I would like to usepurrr::dmap_if
and Matrix::model.matrix
together to to do this. When I run
do.call(model.matrix, list(Improved~.,Arthritis))
working fine.
When I use below code is not working
Arthritis %>% dmap_if(is.factor, do.call(model.matrix, list(Improved~., .)))