I have a dataset of instances of protests in the US and want to assign certain values to a district variable based on the state and the county. Basically I want to "tell" the code "If an event occured a) in X state and b) in one of Y districts it belongs in Z district. I tried this:
#Alabama
dfprotest$district[dfprotest$ADMIN1=="Alabama" & dfprotest$ADMIN2=="Washington" | "Mobile" | "Baldwin" |
"Escambia" | "Monroe" | "Clarke"]<- "AL-1"
It didn't work though. Anyone want to help an R-noob out?