📜  na 按列 - R 编程语言代码示例

📅  最后修改于: 2022-03-11 14:52:00.258000             🧑  作者: Mango

代码示例1
df <- data.frame(x = c(1,2,NA), y = rep(NA, 3))

# Which column has na?
colSums(is.na(df))[colSums(is.na(df)) > 0]

# which rows?
df[which(rowSums(is.na(df)) > 0),]