I have a survey data frame with individual-level observations. I want to merge this data frame with another data frame with country-level variables (one row per country-year). This latter should repeat the rows according to the number of rows in the individual-level data frame. I have been tried this using the rep()
function but it didn't work. I don't know if I was clear, but I would thank you so much if anyone can help.
Asked
Active
Viewed 144 times
0

Ben Bolker
- 211,554
- 25
- 370
- 453
-
1Welcome to SO! Please read [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – markus Dec 28 '19 at 17:57
-
1`?merge`, in base R, or one of the join functions in the tidyverse (e.g. `?dplyr::full_join`, is probably what you want. If you provide a reproducible example someone can write an answer with a little more detail. – Ben Bolker Dec 28 '19 at 18:00