R 统计True/ False的数目

统计xx内TRUE 的数量

sum(xx)

注意,若xx内有NA, 使用sum会返回NA。所以最好使用:

sum(xx, na.rm = T)


原文地址:https://www.cnblogs.com/emanlee/p/14877789.html