使用df
date <- c(rep(as.Date("2003-01-05"), 5), rep(as.Date("2004-01-05"), 5), rep(as.Date("2005-01-05"), 5), rep(as.Date("2006-01-05"), 5))
parameter <- rep(c("param_A", "param_B", "param_C", "param_D", "param_E"), 4)
df <- data.frame(date, parameter)
df$year <- year(df$date)
如何删除param_A
的{{1}},但保留所有其他年份?
答案 0 :(得分:5)
我们可以尝试filter
df %>%
filter(!(parameter=="param_A" & year == 2003))