I have two identical dataset: the population and the sample which is a subset of the population dataset drawn with sample_n() function without replacement. In both of the dataset I have a unique id for every observation assigned earlier before drawing this sample subset.
Now my problem is I want to go back to the population dataset and create a new column we may call it respondent category(a binary variable of either population or sample). Here I would like to look up the unique id values in population dataset and compare with the same in the sample dataset. If we find the unique id in the sample data frame corresponding to the population data frame we assign that cell sample indicating that that observation has been assigned to our sample data frame else population
Normally I do this in excel using xlook-up function but I would appreciate if someone can help with a code to execute this on R tidyverse context. Attached dataset helps elaborate my problem.