Identifying and removing "NA"s and other errors [duplicate]
Possible Duplicate:
开发者_StackOverflow Test for NA and select values based on result
Suppose you have a vector -- you do a calculation on the vector -- many of the elements return "NA" -- how do you identify these "NA"s and change them to some usable integer
Assuming that your data is in dat
(could be a vector, matrix, or data frame):
dat[is.na(dat)]<-0
replaces all NA
entries of dat
with 0
.
精彩评论