Skip to content

Instantly share code, notes, and snippets.

@houshuang
Created May 22, 2013 19:11
Show Gist options
  • Save houshuang/5630095 to your computer and use it in GitHub Desktop.
Save houshuang/5630095 to your computer and use it in GitHub Desktop.
db <- as.data.frame(lapply(db, function(x){
x <- as.character(x)
replace(x, x == "0", NA)
x <- as.factor(x)}))
db <- as.data.frame(lapply(db, function(x){
x <- as.character(x)
replace(x, x == "", NA)
x <- as.factor(x)}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment