开发者

Identifying and removing "NA"s and other errors [duplicate]

This question already has an answer here: Closed 10 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜