[Rd] sparse.model.matrix Generates Non-Existent Factor Levels if Ord.factor Columns Present

Dario Strbenac dstr7320 at uni.sydney.edu.au
Fri Feb 9 01:00:11 CET 2018


Good day,

The intention is to convert the dataset into a format suitable for the random forest classifier implemented by the CRAN package xgboost. The input data is required to be transformed into one-hot format using the sparse.discrim.matrix function, as specified by the package's vignette of URL https://cran.r-project.org/web/packages/xgboost/vignettes/discoverYourData.html I did not know to read the help page for contr.poly after reading the sparse.discrim.matrix help page. Perhaps there could be a helpful mention added to it?

--------------------------------------
Dario Strbenac
University of Sydney
Camperdown NSW 2050
Australia


More information about the R-devel mailing list