i have a data set with different diagnosis codes for patients that i want to filter through and view the patients that contain any of the codes i am interested in. i am currently using the str_detect function to filter all of the columns but want to know how to specify only the diagnosis code columns. as well how to create a statement that can include multiple strings to detect; ex: O99019 and 0909
filter(if_any(everything(), ~ str_detect(., "O99019")))
patient_id dx1 dx2 dx3 dx4 dx5 dx6 dx7 dx8 dx9 dx10 dx11 dx12 dx13 dx14 dx15
<dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 12812360 28262 2768 311 4019 53081 4011 28261 NA NA NA NA NA NA NA NA
2 12812360 28262 2859 4019 28260 4011 NA NA NA NA NA NA NA NA NA NA
3 12812360 28262 2859 4019 28261 2827 NA NA NA NA NA NA NA NA NA NA
4 12812360 28262 2859 4019 7295 NA NA NA NA NA NA NA NA NA NA NA
5 12812360 T8029XA D5700 F329 I10 Z6833 Z79899 D571 L03113 Z79891 D57219 K219 L03119 R509 NA NA
6 12812360 D5700 D509 I10 Z79899 D219 D57419 M7989 M79662 NA NA NA NA NA NA NA