I have a dataframe that simplified looks like this only it has 2k rows. I\'m wondering if there\'s a way to either extract data or filter data by the values in the LocationI
We can do this with tidyverse
tidyverse
library(dplyr) library(stringr) df1 %>% filter(str_detect(LocationID, '\\b(River|Creek)\\b')) # LocationID Code #1 Alk River 232 #2 Bala River 4324 #3 Cake River 432 #4 Alk Creek 6767 #5 Cake Creek 766