Skip to content

Instantly share code, notes, and snippets.

@oleon12
Last active August 29, 2015 14:21
Show Gist options
  • Save oleon12/f09e44056040037c537b to your computer and use it in GitHub Desktop.
Save oleon12/f09e44056040037c537b to your computer and use it in GitHub Desktop.
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