0

I'm trying to filter my dataset for multiple categorical data. Essentially I have a dataset of crimes for many different neighborhoods, but I only want to look at variables that concerns 18 neighborhoods (instead of the 100 neighborhoods in the dataset).

This code works for one neighborhood, but I can't seem to figure out how to filter the data for 18 neighborhoods.

Police_Force <- Police_Use_of_Force %>% filter(Neighborhood == "Downtown West")

I have tried this

Police_Force <- Police_Use_of_Force %>% filter(Neighborhood == "Downtown West, Jordan, Hawthorne, Near - North, Willard - Hay, Folwell, Ventura Village, Lowry Hill East, Marcy Holmes, Midtown, Phillips, McKinley, Holland, CARAG, Audubon Park, Beltrami, ECCO, Hale")

and this

Police_Force <- Police_Use_of_Force %>% filter(Neighborhood == "Downtown West" "Jordan", "Hawthorne", "Near - North", "Willard - Hay", "Folwell", "Ventura Village", "Lowry Hill East", "Marcy Holmes", "Midtown Phillips", "McKinley", "Holland", "CARAG", "Audubon Park", "Beltrami", "ECCO", "Hale")

I would appreciate it if anybody could help me with this.

Thank you in advance!

ekoam
  • 8,744
  • 1
  • 9
  • 22
Bloop
  • 43
  • 1
  • 6
  • `Police_Force <- Police_Use_of_Force %>% filter(Neighborhood %in% c("Downtown West, Jordan, Hawthorne, ..."))` – Ronak Shah Oct 28 '20 at 10:28
  • %in% c worked, but each subject needed a " ", so Police_Force <- Police_Use_of_Force %>% filter(Neighborhood %in% c("Downtown West", "Jordan", "Hawthorne", ...)) Thank you! – Bloop Oct 28 '20 at 11:05

0 Answers0