I am trying to subset a dataframe (n=16070) based on county name, which is coded as a string variable. The dataset looks like the following:
county asthma eviction_rate
Alameda 10 1.2
Contra Costa 12 3.2
Orange 9 9.6
San Francisco 1 4.5
I used the following code:
state_file <- subset(state_file, state_file$county != c('Alameda', 'Contra Costa'))
When I run the code, I get the following error message:
Warning message:
In state_file$county != c("San Mateo", "San Francisco", "Contra Costa", :
longer object length is not a multiple of shorter object length
The output that I do get includes the aforementioned counties.