开发者

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

开发者 https://www.devze.com 2023-04-07 19:58 出处:网络
This question already has an answer here: Closed 10 years ago. Possible Duplicate: 开发者_StackOverflowTest for NA and select values based on result
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

精彩评论

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