Suppose I have a data.frame in the following format:
Site CowId Result
FarmA 1000 c("Aerococcus viridans", "Staphylococcus chromogenes")
FarmA 1001 Staphylococcus aureus
FarmA 1002 Contaminated
How can I check if Staphylococcus chromogenes is a member within any of the sets without unnesting any potential vectors within the Result column?
df <- structure(list(Site = structure(c(1L, 1L, 1L), .Label = "FarmA", class = "factor"), CowId = 1000:1002, Result = list(c("Aerococcus viridans", "Staphylococcus chromogenes"), "Staphylococcus aureus", "Contaminated")), class = c("grouped_df", "tbl_df", "tbl", "data.frame"), row.names = c(NA, -3L), groups = structure(list( Site = structure(c(1L, 1L, 1L), .Label = "FarmA", class = "factor"), CowId = 1000:1002, .rows = structure(list(1L, 2L, 3L), ptype = integer(0), class = c("vctrs_list_of", "vctrs_vctr", "list"))), class = c("tbl_df", "tbl", "data.frame" ), row.names = c(NA, -3L), .drop = TRUE))