Take data frame and turn it into matrix for logistic regression

covariate_df_to_mat(mc_trees, cov_names)

Arguments

mc_trees

data frame with cov_names

cov_names

null or string of vector

Value

matrix of dimension n x (p+1)

Details

if cov_names is NA, then we return a matrix of 1 column of 1s. This is the case of having \(beta_0\) only. Otherwise, we return the matrix with 1 column of 1s for the intercept and the rest of the variables.