I have for example 5 states and multiple cities for each state. I want to select only 1 city per state. I am trying this code:
country <- subset(country, country$state == "1" & country$city == "1" |
country$state == "2" & country$city == "4" |
country$state == "3" & country$city == "3" |
country$state == "4" & country$city == "2" |
country$state == "5" & country$city == "101")
Is there another way to do this? I find this code very ugly and unoptimal.