Skip to content

count of accession in Vintro or in Cryo

@slgora try the code below:

# --------- ADDED METRIC: Entries with STORAGE containing at least one of "30" or "40" ---------
storage_30_or_40_metric <- combined_allcrops %>%
  mutate(
    STORAGE = as.character(STORAGE),
    has_30_or_40 = str_detect(STORAGE, "\\b30\\b") | str_detect(STORAGE, "\\b40\\b")
  ) %>%
  group_by(Crop_strategy) %>%
  summarise(
    count_with_30_or_40 = sum(has_30_or_40, na.rm = TRUE),
    total_records = n(),
    perc_with_30_or_40 = round(100 * count_with_30_or_40 / total_records, 2)
  )