Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
If you need change numbers treat as characters in a data frame to numeric class, this function will be useful.
toNum <- function(x){
for (i in 1:length(x)){
matrix <- as.matrix(x)
x[,i] <- as.numeric(matrix[,i])
#At the end, all characters in the data frame will be numeric type variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment