For glm2 package trying to convert factor to numeric and preserving it as a dataframe
问题 Use package glm2 and mlbench in R, I am testing with the BreastCancer dataset. I started with 10 columns in the data frame with 479 observations. I want to convert 9 out of 10 columns from factor to numeric and preserve the data frame but my new data frame became a data frame of 2 columns instead of the 10 ? Here is my code library(mlbench) library(glm2) data(BreastCancer) BC = na.omit(BreastCancer) BC = BC[, -1] indexes = sample(1:nrow(BC), size=0.3*nrow(BC)) BCtrain = BC[-indexes,] as