How do I filter rows across a large data set to remove unwanted values?

Here is a simplified example using a data set I manually constructed. In the future, please try to provide a data set that can be easily copied by others. See the link at the end of this post.

library(dplyr)
DF <- data.frame(Code = c("A1", "A2", "B1"),
                 Phylum = c("A", "A", "B"),
                 S001_F1 = c("-", "-", "-"),
                 S001_F2 = c("-", "P", "-"),
                 S002_F1 = c("-", "-", "-"))
DF
#>   Code Phylum S001_F1 S001_F2 S002_F1
#> 1   A1      A       -       -       -
#> 2   A2      A       -       P       -
#> 3   B1      B       -       -       -
DFnew <- DF |> rowwise() |> 
  mutate(FindP = any(c_across(cols = S001_F1:S002_F1) == "P"))
DFnew
#> # A tibble: 3 x 6
#> # Rowwise: 
#>   Code  Phylum S001_F1 S001_F2 S002_F1 FindP
#>   <chr> <chr>  <chr>   <chr>   <chr>   <lgl>
#> 1 A1    A      -       -       -       FALSE
#> 2 A2    A      -       P       -       TRUE 
#> 3 B1    B      -       -       -       FALSE
DFnew <- DFnew |> filter(!FindP)
DFnew
#> # A tibble: 2 x 6
#> # Rowwise: 
#>   Code  Phylum S001_F1 S001_F2 S002_F1 FindP
#>   <chr> <chr>  <chr>   <chr>   <chr>   <lgl>
#> 1 A1    A      -       -       -       FALSE
#> 2 B1    B      -       -       -       FALSE

Created on 2022-06-07 by the reprex package (v2.0.1)

FAQ: How to do a minimal reproducible example ( reprex ) for beginners - meta / Guides & FAQs - RStudio Community