我想删除数据框中与location = 2,4和out对应的行。见下面的数据。
date <- c("2016-03-24","2016-03-24","2016-03-24","2016-03-24","2016-03-24",
"2016-03-24","2016-03-24","2016-03-24","2016-03-24","2016-03-24")
location <- c(1,1,2,2,3,3,4,4,"out","out")
sensor <- c(1,16,1,16,1,16,1,16,1,16)
Temp <- c(35,34,92,42,21,47,37,42,63,12)
df <- data.frame(date,location,sensor,Temp)
答案 0 :(得分:2)
试试这个......
df_new = df[!df$location %in% c("2","4","out"),]