Converting a data.frame to a numerical matrix in R, not so easy!
www.emilkirkegaard.com
Edit 2019 You don't really need the below. Look at the `model.matrix()` function, which converts data frames into matrices for glmnet and similar function. Original post Sometimes you need to use a function that wants a numeric matrix as input. One such function is glmnet.cv() which performs lasso regression with cross validation, which is
Converting a data.frame to a numerical matrix in R, not so easy!
Converting a data.frame to a numerical matrix…
Converting a data.frame to a numerical matrix in R, not so easy!
Edit 2019 You don't really need the below. Look at the `model.matrix()` function, which converts data frames into matrices for glmnet and similar function. Original post Sometimes you need to use a function that wants a numeric matrix as input. One such function is glmnet.cv() which performs lasso regression with cross validation, which is