Closed theanita1 closed 1 year ago
Hi, thanks for using our package!
I’m sorry you run into this, but I’m very happy that you raise this bug here.
Could you provide us with a very small minimum data set, without any sensitive data? So just for example the name of the MO and your antibiotic columns? I’m sure we can fix this easily, and a new version will be on CRAN soon so the timing is perfect!
Hi Matthijs,
Here's a subset of my data (probably bigger than minimum but made sure there's some Abc in there)
p.s. am enjoying having R do the interpretation for me rather than me! thanks for creating this
I see what's going on 🙂
You are trying to run mdro()
on MIC values, instead running it on R/SI values.
So what I did after importing your file is this:
library(dplyr)
library(AMR)
# I also save to 'gram_negatives_mic' here, other than the example screenshot below
gram_negatives_mic <- gram_negatives %>%
mutate(mo_code = as.mo(organism)) %>%
mutate(across(Amikacin:`Trimethoprim/Sulfamethoxazole`, as.mic))
This gave me valid MIC values. So normally I would proceed like this:
gram_negatives_rsi <- gram_negatives_mic %>%
mutate_if(is.mic, as.rsi, guideline = "CLSI 2022"))
This will turn your MIC's to R/SI values according to a certain guideline (included are CLSI 2013-2022 and EUCAST 2013-2022). But in the beta version this throws a lot of notes that breakpoints are lacking for some combinations. The function is also too slow at the moment. I need to work on this and will return to you soon.
Hi Mattijs
I sent you a raw version of my database - in my attempts to this point I have been creating mic variables and then making an MIC subset (obviously your way is much faster but I didn't know about the "across" option). Here is my coding so you can see what I've done to get to the error point... gnsop.txt
Could it also be that I've been running the default interpretation of the rsi (which when I run it is eucast 2021)? You used the CLSI interpretation in your coding above
Found the solution! And I must congratulate you - you've found a bug 🥳
Since you have the column names "Ceftriaxone" and Ceftriaxone.1", the mdr_cmi2012()
function didn't know which ceftriaxone column to pick and crashed. I've fixed this quickly, but have to run some tests to be sure it's robust. In other words, you helped making this package improve and that's great.
Could it also be that I've been running the default interpretation of the rsi (which when I run it is eucast 2021)? You used the CLSI interpretation in your coding above
No, that's because I learned from our Twitter conversation that you're not from Europe and I assumed you wouldn't use EUCAST over there 🙂. It shouldn't make any functional difference for running as.rsi()
.
Am trying to run the mdro function in the AMR package in R and when it gets to Table 5 Acinetobacter spp it comes up with the following error:
Prior to this I've run the eucast rules, cleaned for first isolates etc. with no issues.
`[<-.data.frame
(*tmp*
, , lst_vector, value = list(GEN = c(3L, : duplicate subscripts for columnsIf I make a subset df without Acinetobacter the function runs to completion.
If I make a subset df without gentamycin (GEN), it throws the same error with tobramycin (TOB), and subsequently amikacin (AMK).
If I run the function on the df before the eucast rules were applied it makes the same error.