Created
February 12, 2019 20:47
-
-
Save malcolmbarrett/b387980cc1beaded3db4826ecf9a0e83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
patient_db <- tibble( | |
patient = c("a", "b", "c"), | |
RecordAxisCondition1 = c("T400", "I560", "T401"), | |
RecordAxisCondition2 = c("T402", "N179", "R111"), | |
RecordAxisCondition3 = c("N180", "X46", "N179") | |
) | |
search_codes <- c("T400", "T401", "T402", "T403", "T404", "T406") | |
patient_db %>% | |
gather("record", "code", -patient) %>% | |
group_by(patient) %>% | |
summarize(tally = sum(code %in% search_codes)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment