Hi, kayj wrote: > Hi, > > I do have a data set with some missing values that appear as blanks. I want > to fill these blanks with an NA. How can this be done? Thanks for your help
Something like this? > my.data<-data.frame("var"=c(1,2,5,"",66,4,3,"",67,5,3,2,1,4,32,56,23), stringsAsFactors=F) > my.data$var [1] "1" "2" "5" "" "66" "4" "3" "" "67" "5" "3" "2" "1" "4" "32" "56" "23" > my.data$var[ my.data$var=="" ] <-NA > my.data$var [1] "1" "2" "5" NA "66" "4" "3" NA "67" "5" "3" "2" "1" "4" "32" "56" "23" Kind regards, Kimmo ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.