处理 R 中的缺失值
Handling missing values in R
我有如下数据
Name Location profits loss sales address revenue stocks
AA London 20 30 2 Lheigts,20109 54 45
BB Boston NA NA NA KicK,30029 NA NA
CC Mumbai NA 2 NA New, 10023 43 NA
我想要这样的输出,它将删除利润、亏损、销售额、收入、库存完全缺失的案例。有什么想法吗?
Name Location profits loss sales address revenue stocks
AA London 20 30 2 Lheigts,20109 54 45
CC Mumbai NA 2 NA New, 10023 43 NA
尝试
df1[rowSums(!is.na(df1[c(3:5,7:8)]))!=0,]
我有如下数据
Name Location profits loss sales address revenue stocks
AA London 20 30 2 Lheigts,20109 54 45
BB Boston NA NA NA KicK,30029 NA NA
CC Mumbai NA 2 NA New, 10023 43 NA
我想要这样的输出,它将删除利润、亏损、销售额、收入、库存完全缺失的案例。有什么想法吗?
Name Location profits loss sales address revenue stocks
AA London 20 30 2 Lheigts,20109 54 45
CC Mumbai NA 2 NA New, 10023 43 NA
尝试
df1[rowSums(!is.na(df1[c(3:5,7:8)]))!=0,]