38 lines
1.1 KiB
R
38 lines
1.1 KiB
R
|
require(tidyverse)
|
||
|
|
||
|
inspectRead = 10
|
||
|
dataPath = 'data'
|
||
|
|
||
|
abNames = read_rds('data/abNames.rds')
|
||
|
|
||
|
filename = list.files(dataPath, paste0('read_', inspectRead, '_*'))
|
||
|
d = read_rds(file.path(dataPath, filename)) #%>%
|
||
|
# left_join(abNames, by = c('ab.amr' = 'nameAMR'))
|
||
|
# list a sampleid that occurs more often but not too often
|
||
|
examples = d %>% count(sampleid) %>% arrange(desc(n)) %>% filter(n < 50)
|
||
|
|
||
|
view_d = d %>%
|
||
|
select(sampleid, date, IsolNr, MIC, mo, RIS, ab.amr, RAP) %>% #, name4d, nameAMRlong) %>%
|
||
|
mutate(asmo = suppressWarnings(as.mo(mo))) %>%
|
||
|
arrange(sampleid, IsolNr) #%>%
|
||
|
# filter(sampleid == examples$sampleid[i])
|
||
|
|
||
|
has_ecoli = view_d %>% filter(str_starts(asmo, 'B_ES'))
|
||
|
examples_having_ecoli = has_ecoli %>%
|
||
|
filter(sampleid %in% examples$sampleid) %>%
|
||
|
pull(sampleid) %>%
|
||
|
unique()
|
||
|
|
||
|
e = 2
|
||
|
view(view_d %>%
|
||
|
filter(sampleid == examples_having_ecoli[e]) %>%
|
||
|
mutate(IsolNr = as.numeric(IsolNr)) %>%
|
||
|
arrange(IsolNr),# %>%
|
||
|
#distinct(sampleid, date, IsolNr, mo, ab.amr, .keep_all = T),
|
||
|
title = 'example')
|
||
|
|
||
|
if (F) {
|
||
|
view(view_d)
|
||
|
view_d %>% filter(!is.na(mo)) %>% pull(mo) %>% unique()
|
||
|
}
|