Skip to content

Instantly share code, notes, and snippets.

@Teino1978-Corp
Forked from RMinto/cleaning.r
Last active September 1, 2015 08:40
Show Gist options
  • Save Teino1978-Corp/d7b586e991e201c8646f to your computer and use it in GitHub Desktop.
Save Teino1978-Corp/d7b586e991e201c8646f 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