📅  最后修改于: 2022-03-11 14:51:58.148000             🧑  作者: Mango
library(dplyr)
df1 %>% inner_join(df2, by= "ID") %>%
mutate(Count = coalesce(Count.x, Count.y)) %>%
select(ID, Count)
# ID Count
# 1 11 345
# 2 22 456
# 3 33 786
# 4 44 765
# 5 55 890
# 6 66 888
# 7 77 654