Hi, I am not sure about the problem. If your non-numeric vector is like: a,b,,d,e,,f
vec1<-unlist(str_split(readLines(textConnection("a,b,,d,e,,f")),",")) vec1[vec1==""]<- NA vec1 #[1] "a" "b" NA "d" "e" NA "f" If this doesn't work, please provide an example vector. A.K. >Thanks for the response. That seems to do the trick as far replacing the >empty cells with <NA>, however, the problem remains that the vector is not >numeric. This was the reason I wanted to replace the empty cells with NAs in the first place. Forcing the vector with as.numeric afterwards doesn't >seem to work either, I get nonsensical results. ______________________________________________ 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.