I am pretty new to R, maybe you can help I believe its quite simple, but somehow i cant make it work. I have two datasets A and B,which I want to merge together. The columns are called country, rate and year.
Dataset A would look like this
structure(list(Country = c("A", "A", "B", "B", "C", "C"), Year = c(2010,2015, 2010, 2015, 2010, 2015), Rate = c(0.1, 0.1, NA, NA, NA,NA)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"))
and Dataset B like this
structure(list(Country = c("B", "B"), Year = c(2010, 2015), Rate = c(0.8,0.9)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"))
I want to merge A and B by country and year, and I only want one extra column showing the rate. I tried all types of joins, but I didnt find a solution yet. I dont want the columns in the output to be rate.x and rate.y.
Thanks for your help