Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大家好,这是我的第一篇文章,我需要帮助将几个向量中的 NA 数量相加
例如..
c1<-c(1,2,NA,3,4) c2<-c(NA,1,2,3,4) c3<-c(NA,1,2,3,4)
我将如何获得仅将向量中的 NA 数量相加的结果?
the.result.i.want<-c(2,0,1,0,0)
您的问题措辞不好,但看起来您想要colSums使用 with rbindand的结果is.na:
colSums
rbind
is.na
> colSums(is.na(rbind(c1, c2, c3))) [1] 2 0 1 0 0