I am relatively new to R and I can not figure out a way of making my code work. I have a dataset with all the municipalities of the Netherlands and I want to print only the municipalities that are in my list named b. If I select a number inside my dataframe by using df[i] it also contains levels. Would it work without the levels?
df contains all municipality names of the Netherlands and b is a list of reshaped municipalities
df <- mun_neth$GM_NAAM
b <- list(gem_her$Nieuwe.gemeente)
for(i in df){
a <- df[i]
if(a in b){
print(a)
}}