Merge Two Data Frames by Two Columns

I am attempting to Merge two large data frames that share two columns in common, Month and Year. I attempted the following code:

MassBalance <- Dataset %>% right_join(Monthly_flows_2009_2019, by=c("Year", "Month"))

I received the following error:

Error in Dataset %>% right_join(Monthly_flows_2009_2019, by = c("Year", :
could not find function "%>%"

I am pretty new to R so I would appreciate any feedback. I think I may be missing a library?

What happens if you run library(dplyr)?

It worked! Since it popped up and showed that it was an extension of dplyr I thought it was already loaded. Thank you!

1 Like

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.