Мы можем сделать это с inner_join
library(dplyr)
df3 <- inner_join(df1, df2)
df3
# date time_of_day
#1 2018-06-03 morning
#2 2018-06-09 morning
#3 2018-06-10 afternoon
и anti_join
df4 <- anti_join(df1, df2)
df4
# date time_of_day
#1 2018-06-06 afternoon
data
df1 <- structure(list(date = c("2018-06-03", "2018-06-06", "2018-06-09",
"2018-06-10"), time_of_day = c("morning", "afternoon", "morning",
"afternoon")), class = "data.frame", row.names = c("1", "2",
"4", "5"))
df2 <- structure(list(date = c("2018-06-03", "2018-06-06", "2018-06-08",
"2018-06-09", "2018-06-10", "2018-06-11"), time_of_day = c("morning",
"morning", "morning", "morning", "afternoon", "afternoon")),
class = "data.frame", row.names = c("1",
"2", "3", "4", "5", "6"))