Closed amyerspigg closed 1 year ago
https://github.com/COMPASS-DOE/EXCHANGE/blob/6b8ba5a0aa8492935744dc7a2ef4ad6c87333b16/Processing_Scripts/water_npoc_tdn.R#L138
Some code to get started.... metadata_directory = "https://drive.google.com/drive/folders/1IQUq_sD-Jama7ajaZl1zW_9zlWfyCohn"
metadata_file <- drive_ls(metadata_directory) %>% filter(grepl("KitLevel", name)) %>% pull(name)
drive_download(metadata_file, overwrite = T)
metadata_collected <- read_csv(metadata_file) %>% select(kit_id, samples_collected) %>% mutate(Sediment = ifelse(str_detect(samples_collected, "Sediment"), T, F), Wetland = ifelse(str_detect(samples_collected, "Wetland"), T, F), Transition = ifelse(str_detect(samples_collected, "Transition"), T, F), Upland = ifelse(str_detect(samples_collected, "Upland"), T, F)) %>% pivot_longer(cols = c(Sediment, Wetland, Transition, Upland), names_to = "transect_location", values_to = "collected")
created draft csv file with this information pushed to the repo as npoc_samples_collectedvsmeasured.csv
https://github.com/COMPASS-DOE/EXCHANGE/blob/6b8ba5a0aa8492935744dc7a2ef4ad6c87333b16/Processing_Scripts/water_npoc_tdn.R#L138
Some code to get started.... metadata_directory = "https://drive.google.com/drive/folders/1IQUq_sD-Jama7ajaZl1zW_9zlWfyCohn"
Next, list all files in the directory, filter out the Kit Level file and snag the file name
metadata_file <- drive_ls(metadata_directory) %>% filter(grepl("KitLevel", name)) %>% pull(name)
Now download that file to your local (an annoying googledrive requirement)
drive_download(metadata_file, overwrite = T)
Finally, read those data in and format so we can set up a list of all samples received
metadata_collected <- read_csv(metadata_file) %>% select(kit_id, samples_collected) %>% mutate(Sediment = ifelse(str_detect(samples_collected, "Sediment"), T, F), Wetland = ifelse(str_detect(samples_collected, "Wetland"), T, F), Transition = ifelse(str_detect(samples_collected, "Transition"), T, F), Upland = ifelse(str_detect(samples_collected, "Upland"), T, F)) %>% pivot_longer(cols = c(Sediment, Wetland, Transition, Upland), names_to = "transect_location", values_to = "collected")