convert to factor r code example
Example 1: r dataframe convert factor to numeric
breast$class <- as.numeric(as.character(breast$class))
Example 2: r dataframe convert factor to numeric
breast[,'class'] <- as.numeric(as.character(breast[,'class']))