This function converts a data frame into a numeric matrix.
If the data frame contains factor variables, they are first converted to
dummy variables (one-hot encoding).
If the data frame contains character variables, they are first converted to
factors and then to dummy variables.