Hi, I have a df like this:
data <- structure(list(idcampione = c("124682/11", "124682/11", "124682/11",
"124682/11", "124682/11", "124682/11", "124682/11", "119764/1",
"119764/1", "119764/1", "119764/1", "119764/1", "123462/1", "123462/1",
"123462/1", "123485/1", "123485/1", "123485/1", "123485/1", "123789",
"123789", "123789", "123789", "123789", "123789"), chemioterapico = c("kanamicina",
"streptomicina", "cloxacillina", "enrofloxacin", "flumequina",
"sulfonamidi composti", "spectinomicina", "kanamicina", "streptomicina",
"trimeth.+ sulfam", "flumequina", "spectinomicina", "kanamicina",
"streptomicina", "flumequina", "kanamicina", "streptomicina",
"flumequina", "spectinomicina", "eritromicina", "kanamicina",
"spiramicina", "streptomicina", "tetraciclina", "trimeth.+ sulfam"
)), row.names = c(NA, -25L), class = c("tbl_df", "tbl", "data.frame"
))
I would like to calculate how often there is a combination of antibiotics.
For example: assuming I have 3 ids: and all three have the association: kanamycin + streptomycin. The result I would like is, therefore kanamycin + streptomycin = 3.
This type of cross should be done to understand which antibiotics are most frequently involved in multiresistances.
TL;DR: the question I have to answer is: what are the antibiotics that are most frequently present in multiresistances? (and so far it's easy).
The hard part is: there are multiple antibiotics that are frequently involved together in multiresistance?
If anyone has any ideas about it I am grateful.