Skip to content

Instantly share code, notes, and snippets.

@RMinto
Created January 30, 2015 20:17
Show Gist options
  • Save RMinto/218c788b42f221d92cdd to your computer and use it in GitHub Desktop.
Save RMinto/218c788b42f221d92cdd to your computer and use it in GitHub Desktop.
cleaning
make.numeric <- function(data, x) {
for (i in x) {
data[ , i] <- as.numeric(data[ , i])
}
data
}
make.char <- function(data, x) {
for(i in x) {
data[ , i] <- as.character(data[ , i])
}
data
}
make.factor <- function(data, x) {
for (i in x) {
data[ , i] <- as.factor(data[ , i])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment