r data change variable to factor code example
Example 1: r dataframe convert factor to numeric
indx <- sapply(breast, is.factor)
breast[indx] <- lapply(breast[indx], function(x) as.numeric(as.character(x)))
Example 2: r dataframe convert factor to numeric
breast[,'class'] <- as.numeric(as.character(breast[,'class']))