Hi!
I have two data frames. In one data frame, I have 17070 observations, ordered by an ID. One variable is residential municipality. In another data frame, I have some extra information to every residential municipality (2096 observations) like the rurality of the are (rur_type
). Now, I would like to add that rur_type
to my big data frame.
Here is a sample data:
library(dplyr)
id <- c(1,2,3,4,5,6,7,8,9,10)
r_m <- c(101, 202, 101, 301, 201, 101, 302, 203, 203, 202)
x_data <- data.frame(id, r_m)
r_m <- c(101,201,202,203,301)
rur_type <- c(1,2,2,4,3)
rur_data <- data.frame(r_m, rur_type)
I would like to add the variable rur_type
to the x_data
as a new column. I tried it with the join function, but then I would have only 5 values observations instead of 10.
Hope, I was clear enough in explaining my problem.