Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALL - missing sample check #90

Open
stephpenn1 opened this issue Dec 4, 2023 · 0 comments
Open

ALL - missing sample check #90

stephpenn1 opened this issue Dec 4, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@stephpenn1
Copy link
Member

Example missing sample check from TCTN, fill in with analyte-specific column names:

# 5. Check with Metadata for missing:

source("./Processing_Scripts/Metadata_kit_list.R")

metadata_collected %>%
  filter(sample_method == "jar", transect_location != "sediment") -> meta_filter

data_clean %>%
  full_join(meta_filter, by = c("campaign", "kit_id", "transect_location"))  %>%
  # add rows for samples not collected, creating a "full" dataset of all possible samples
  mutate(tc_flag = case_when(collected == FALSE & is.na(carbon_weight_perc) & is.na(tc_flag) ~ "sample not collected",
                             notes == "kit compromised" ~ "kit compromised",
                             notes == "sample compromised" ~ "sample compromised",
                             TRUE ~ tc_flag),
         tn_flag = case_when(collected == FALSE & is.na(nitrogen_weight_perc) & is.na(tn_flag) ~ "sample not collected",
                             notes == "kit compromised" ~ "kit compromised",
                             notes == "sample compromised" ~ "sample compromised",
                             TRUE ~ tn_flag),
         carbon_weight_perc = case_when(notes == "kit compromised" ~ NA,
                                        notes == "sample compromised" ~ NA,
                                        TRUE ~ carbon_weight_perc),
         nitrogen_weight_perc = case_when(notes == "kit compromised" ~ NA,
                                          notes == "sample compromised" ~ NA,
                                          TRUE ~ nitrogen_weight_perc)) %>% 
  select(-c(sample_type, sample_method, collected, notes)) -> tctn_full
@stephpenn1 stephpenn1 added the documentation Improvements or additions to documentation label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant