如果列Conf_mat_Modis_2000
中的值等于0或NA,我想删除Driver_90_00_Visual
表中的行。有人可以帮我解决这个问题。
dput(Conf_mat_Modis_2000)
structure(list(Driver_90_00_Modis500 = c(100, 200, 200, 100,
100, 200, 200, 200, 100, 200, 500, 100, 100, 100, 100, 100, 100,
100, 100, 500, 500, 100, 200, 200, 100, 500, 100, 100, 500, 100,
100, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 200,
100, 300, 100, 200, 100, 200, 100, 100, 100, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 200, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 200, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 200, 200, 200, 200, 200, 500, 200,
200, 500, 500, 500, 500, 200, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 200, 500, 500, 200, 200, 200,
200, 200, 100, 200, 200, 100, 200, 500, 500, 500, 200, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 200, 100, 100, 100, 100, 100,
200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
200, 100, 100, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 200, 100, 200, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 200, 100, 100,
200, 100, 100, 100, 100, 100, 100, 100, 100, 500, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 500, 100, 100,
500, 100, 500, 200, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 500,
500, 100, 200, 100, 500, 500, 500, 500, 200, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
200, 200, 200, 100, 500, 500, 500, 100, 200, 100, 100, 100, 200,
100, 200, 200, 200, 100, 100, 100, 100, 500, 100, 100, 200, 100,
100, 100, 100, 500, 500, 100, 200, 200, 200, 200, 200, 500, 200,
200, 200, 200, 200, 200, 200, 200, 200, 500, 100, 200, 200, 500,
200, 200, 500, 200, 200, 200, 200, 200, 200, 200, 500, 200, 500,
200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 500, 200, 200,
200, 200, 100, 200, 200, 200, 200, 200, 200, 200, 200, 100, 200,
200, 100, 200, 100, 100, 100, 200, 200, 200, 200, 100, 200, 200,
100, 200, 200, 100, 200, 200, 200, 200, 200, 200, 200, 200, 200,
200, 200, 200, 200, 200, 200, 100, 200, 200, 200, 200, 200, 200,
200, 200, 100, 200, 200, 100, 200, 200, 200, 200, 100, 200, 200,
200, 200, 200, 200, 100, 200, 200, 100, 200, 100, 100, 100, 200,
100, 100, 100, 100, 200, 100, 500, 100, 100, 100, 500, 100, 200,
100, 100, 200, 200, 200, 200, 100, 100, 200, 100, 200, 100, 200,
200, 200, 200, 200, 100, 100, 500, 100, 200, 100, 200, 200, 200,
100, 100, 200, 100, 100, 200, 100, 200, 200, 200, 100, 200, 100,
200, 200, 100, 100, 100, 100, 100, 200, 100, 100, 100, 100, 200,
200, 100, 200, 100, 100, 100, 100, 100, 200, 200, 100, 100, 200,
200, 100, 200, 100, 200, 200, 200, 200, 200, 100, 200, 200, 200,
200, 100, 200, 200, 200, 100, 100, 500, 200, 100, 100, 100, 200,
200, 200, 200, 100, 100, 100, 200, 200, 200, 100, 200, 200, 200,
200, 200, 200, 200, 200, 200, 200, 200, 200, 100, 500), Driver_90_00_Visual = c(600,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 500, 200, 200, 200, 200,
200, 200, 200, 200, 200, NA, 200, NA, 200, 200, 200, NA, NA,
NA, NA, NA, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, 500, 500, 500, 500, 500, NA, 500, 500, 500, 500, 500, 500,
500, 200, 200, 300, 200, 200, NA, 300, 200, 200, NA, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
NA, NA, NA, NA, NA, NA, 200, 200, NA, 200, 200, NA, NA, 200,
NA, NA, NA, 200, NA, 200, 500, NA, 200, 200, NA, 500, NA, 200,
NA, NA, NA, NA, NA, NA, 200, 200, 500, NA, NA, 200, NA, NA, NA,
200, NA, NA, 200, 200, 200, NA, NA, NA, 200, NA, 200, 200, NA,
200, NA, NA, NA, NA, 200, 200, 200, NA, NA, NA, NA, NA, NA, 200,
NA, NA, 500, NA, NA, NA, NA, NA, 500, NA, NA, NA, NA, NA, 200,
200, NA, 500, NA, NA, NA, NA, 200, 500, NA, 500, 200, 500, NA,
NA, NA, 200, NA, 500, 500, NA, NA, NA, NA, 500, 200, 500, NA,
NA, 200, 200, 200, 200, 200, 200, 500, 500, 500, 500, NA, 500,
200, 200, 200, 500, 500, 200, 500, 500, 200, 200, NA, NA, 200,
200, 200, 200, 200, 200, 200, 200, 200, 200, NA, 500, 500, NA,
NA, NA, 500, NA, NA, NA, NA, NA, NA, NA, NA, 500, 500, NA, NA,
NA, NA, 500, 500, NA, NA, NA, NA, NA, 500, NA, 200, NA, NA, NA,
NA, NA, 500, NA, 500, NA, NA, NA, NA, 500, NA, NA, 600, 600,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
500, 500, NA, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500,
500, NA, NA, NA, 500, 500, NA, NA, 500, 500, 500, 500, 500, 500,
500, 600, 500, 500, 500, 200, 200, 200, NA, 200, NA, 500, 500,
200, 200, 200, 200, NA, 200, 200, 200, 200, 200, 200, 200, 200,
200, NA, 999, 999, NA, 500, 999, 200, 200, 200, 500, 200, 500,
200, 200, 200, 200, 200, 200, 500, 200, 200, 200, 200, 200, 200,
200, 200, 200, 200, 200, 500, 500, 500, 500, 500, 500, NA, 500,
500, 500, 500, 500, 500, 200, 500, 500, 500, 500, 200, 500, 500,
200, 500, 200, 500, 200, 200, 200, 500, NA, 500, 200, 200, 200,
500, 500, 500, 200, 500, 500, 200, 500, 200, 200, 500, 200, 200,
200, 500, 200, 200, NA, NA, NA, 200, 200, 500, 200, 200, 200,
500, 200, 200, 200, 200, 500, 200, 200, 200, 200, 200, 200, 500,
200, 200, 500, 200, 200, 500, 200, 500, 200, 200, 500, 200, 500,
200, 200, 200, 200, 200, 200, 200, 500, 200, 200, 200, 200, 200,
200, NA, 200, NA, 200, 200, 200, 200, 200, 200, 200, NA, NA,
200, 200, 200, 500, 200, 500, 200, 500, 200, 200, 300, 300, 300,
500, 200, 500, 200, 500, 500, 500, NA, 500, 200, 500, NA, 500,
500, 200, 200, 500, 200, 200, 200, 200, 500, 500, 200, 500, 200,
NA, 500)), .Names = c("Driver_90_00_Modis500", "Driver_90_00_Visual"
), class = "data.frame", row.names = c(NA, -1081L))
答案 0 :(得分:0)
假设df是你的数据框,可以做
df[!(df$Driver_90_00_Visual %in% c(0, NA)),]
参考评论:
df_is_na <- df[df$Driver_90_00_Visual != 0 & !is.na(df$Driver_90_00_Visual),]
df_NA <- df[!(df$Driver_90_00_Visual %in% c(0, NA)),]
identical(df_is_na, df_NA)
# [1] TRUE