去除有NA的行和列

##去除NA的行
data1 <- na.omit(data)
##去除NA的列
na_flag <- apply(is.na(data), 2, sum)
data1 <- data[, which(na_flag == 0)]

你可能感兴趣的:(去除有NA的行和列)