Commit validated bk, 118922 Feb 7
This commit is contained in:
95
validatie.R
Normal file
95
validatie.R
Normal file
@ -0,0 +1,95 @@
|
||||
source('global.R')
|
||||
|
||||
if (F) {
|
||||
|
||||
# CoNS
|
||||
radar_data_first %>%
|
||||
mutate(f = mo_name(mo)) %>%
|
||||
filter(f == 'Coagulase-negative Staphylococcus (CoNS)') %>%
|
||||
pull(MO) %>%
|
||||
unique() %>%
|
||||
mo_name()
|
||||
# versus
|
||||
radar_data %>%
|
||||
mutate(f = mo_name(mo)) %>%
|
||||
filter(f == 'Coagulase-negative Staphylococcus (CoNS)') %>%
|
||||
pull(MO) %>%
|
||||
unique() %>%
|
||||
mo_name()
|
||||
# conclusie: Becker = TRUE maakt het verschil
|
||||
|
||||
|
||||
# Fluclox onder SA
|
||||
radar_data_first %>%
|
||||
select(sampleid, patientid, Isolnr, date, MO, mo, FLC) %>%
|
||||
filter(!is.na(FLC), MO == 'staaur') %>% count(patientid, Isolnr, FLC)
|
||||
# conclusie: 212 samples, 142 patienten
|
||||
|
||||
radar_data_first %>%
|
||||
select(sampleid, patientid, Isolnr, date, MO, mo) %>%
|
||||
filter(MO == 'staaur') %>%
|
||||
count(patientid)
|
||||
# 93 samples, 91 patienten
|
||||
|
||||
countSamplesPatients = function(moName4d) {
|
||||
nSamples = radar_data_first %>%
|
||||
select(sampleid, patientid, Isolnr, date, MO, mo) %>%
|
||||
filter(MO == moName4d) %>%
|
||||
count(sampleid) %>%
|
||||
nrow()
|
||||
nPatients = radar_data_first %>%
|
||||
select(sampleid, patientid, Isolnr, date, MO, mo) %>%
|
||||
filter(MO == moName4d) %>%
|
||||
count(patientid) %>%
|
||||
nrow()
|
||||
return(tribble(~mo4d, ~nSamples, ~nPatients,
|
||||
moName4d, nSamples, nPatients))
|
||||
}
|
||||
|
||||
t = countSamplesPatients('staaur') %>%
|
||||
add_row(countSamplesPatients('esccol')) %>%
|
||||
add_row(countSamplesPatients('klepne')) %>%
|
||||
add_row(countSamplesPatients('encfcl')) %>%
|
||||
add_row(countSamplesPatients('enbcco')) %>%
|
||||
add_row(countSamplesPatients('strmgr')) %>%
|
||||
add_row(countSamplesPatients('pseaer')) %>%
|
||||
mutate(mo_name = mo_name(mo4d)) %>%
|
||||
relocate(mo_name, .after = mo4d)
|
||||
}
|
||||
|
||||
|
||||
if (F) {
|
||||
|
||||
allTrue = function(x) { identical(x, rep(T, length(x))) }
|
||||
|
||||
allVal = function(x, val) { identical(x, rep(val, length(x))) }
|
||||
|
||||
whereVal = function(x, val) { which(x == val) }
|
||||
|
||||
whereAll = function(x, val) {
|
||||
rx = which(x %>% map_lgl(~ allVal(., val))) %>% as.numeric()
|
||||
ry = which(z %>%
|
||||
rowwise() %>%
|
||||
mutate(skdsjui3irskjdf = allVal(c_across(), val)) %>%
|
||||
pull(skdsjui3irskjdf)
|
||||
) %>% as.numeric()
|
||||
return(list(cols = colnames(x)[rx], x = rx, y = ry))
|
||||
}
|
||||
|
||||
whereAny = function(x, val) {
|
||||
rx = which(x %>% map_lgl(~any(. == val))) %>% as.numeric()
|
||||
ry = which(x %>%
|
||||
rowwise() %>%
|
||||
mutate(skdsjui3irskjdf = any(c_across() == val)) %>%
|
||||
pull(skdsjui3irskjdf)) %>% as.numeric()
|
||||
return(list(cols = colnames(x)[rx], x = rx, y = ry))
|
||||
}
|
||||
|
||||
whereR = radar_data %>%
|
||||
filter(MO == 'mrsa') %>%
|
||||
select(is.rsi) %>%
|
||||
mutate(across(everything(), as.character)) %>%
|
||||
whereAny('R')
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user