In the following code, how can I remove all df's rows that years equal to the year from df2?
library(dplyr, warn.conflicts = FALSE)
library(readr)
library(lubridate)
id <- "1FYfx8R-oOH7APgwHK7Eh6ZYm2xKXHM85"
df <- readr::read_csv(paste0("https://docs.google.com/uc?id=", id, "&export=download"),
col_names = TRUE)
df <- df %>%
mutate(year = year(datetime), month = month(datetime))
no_year=length(unique(df$year))
df1 <- df %>%
select(-datetime) %>%
group_by(year, month) %>%
summarise_all(funs(sum(. > 0))) %>%
ungroup()
df2=aggregate(month ~ year, data = df1, FUN = length)%>%
filter(month<11)