[R-pkg-devel] Identify Original Column Names of Model Matrix
Ivan Krylov
kry|ov@r00t @end|ng |rom gm@||@com
Tue Oct 11 09:38:35 CEST 2022
On Mon, 10 Oct 2022 08:00:04 +0000
Dario Strbenac <dstr7320 using uni.sydney.edu.au> wrote:
> It requires input data to be in one-hot encoding, which is created by
> Matrix::sparse.model.matrix. For further analysis, such as variable
> importance, is there a way to identify which original feature each
> column of a sparse.model.matrix result was derived from?
?Matrix::sparse.model.matrix seems to recommend
MatrixModel::model.Matrix for this reason. The latter function returns
an object with additional slots `assign` and `contrasts`, which should
make it possible to recover the original columns.
--
Best regards,
Ivan
More information about the R-package-devel
mailing list