I have a several dataframes containing different information about the same individuals which I would like to merge.
N = 1000
district <- rnorm(N)
region <- rnorm(N)
household_id <- rnorm(N)
works <- rbinom(n = N, size = 1, prob = 0.05)
total_income <- rnorm(N)
total_expenditure <- rnorm(N)
df1 <- data.frame(district, region, household_id, works)
df2 <- data.frame(district, region, household_id, total_income)
df2 <- data.frame(district, region, household_id, total_expenditure)
Is there a way I can use the group_indices function, or any other way to generate unique ID number for each observation in order to match individuals in df1 with those in df2 and df3?