From 6a624d7158d5c514c876ceb32439e8323202cb80 Mon Sep 17 00:00:00 2001 From: Pranav Anbarasu Date: Tue, 19 Mar 2024 19:24:55 +0000 Subject: [PATCH] Exclude participants that don't have data indicating what device they used --- scripts/write-output/final-output-concepts.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/write-output/final-output-concepts.R b/scripts/write-output/final-output-concepts.R index 075ba4f..9af8e24 100644 --- a/scripts/write-output/final-output-concepts.R +++ b/scripts/write-output/final-output-concepts.R @@ -37,6 +37,15 @@ combined_output_concepts <- bind_rows(combined_device, combined_healthkit) combined_output_concepts <- combined_output_concepts[!duplicated(combined_output_concepts), ] +valid_participants <- + read.csv(file.path(outputConceptsDir, "participant_devices.csv")) %>% + distinct(participantidentifier) %>% + pull() + +combined_output_concepts <- + combined_output_concepts %>% + filter(participantidentifier %in% valid_participants) + combined_output_concepts %>% write.csv(file.path(outputConceptsDir, "output_concepts.csv"), row.names = F) cat(glue::glue("output_concepts written to {file.path(outputConceptsDir, 'output_concepts.csv')}"),"\n")