I am working with a housing data set and I am trying to see if houses that overlap both counties that are next to each other were recorded in each other's sale when the house(s) were sold.
Here is a sample of my data:
Alameda County
date county city zip price
1 2003-04-27 Alameda County Pleasanton 94588 565000
2 2003-04-27 Alameda County Oakland 94618 387500
3 2003-04-27 Alameda County Dublin 94568 450000
4 2003-04-27 Alameda County Newark 94560 470000
5 2003-04-27 Alameda County Livermore 94550 1120000
6 2003-04-27 Alameda County Alameda 94501 526000
7 2003-04-27 Alameda County Fremont 94538 325000
8 2003-04-27 Alameda County Livermore 94550 930500
9 2003-04-27 Alameda County Hayward 94542 525000
10 2003-04-27 Alameda County Castro Valley 94546 610000
Contra Costa County
date county city zip price
1 2003-04-27 Contra Costa County El Sobrante 94803 325000
2 2003-04-27 Contra Costa County Concord 94519 347000
3 2003-04-27 Contra Costa County Concord 94521 366000
4 2003-04-27 Contra Costa County Walnut Creek 94598 495000
5 2003-04-27 Contra Costa county Concord 94519 370000
6 2003-04-27 Contra Costa County Concord 94520 219000
7 2003-04-27 Contra Costa County Antioch 94531 387000
8 2003-04-27 Contra Costa county Clayton 94517 522000
9 2003-04-27 Contra Costa County Antioch 94531 406500
10 2003-04-27 Contra Costa County Antioch 94509 345000
I was thinking of using dplyr and the filter verb but I think that would require a large logical expression. How can I check if the two data frames have the same city or zip code?