mirror of
https://github.com/msberends/AMR.git
synced 2025-07-12 11:42:00 +02:00
styled, unit test fix
This commit is contained in:
@ -30,8 +30,10 @@ This tries to find a column name in a data set based on information from the \li
|
||||
You can look for an antibiotic (trade) name or abbreviation and it will search \code{x} and the \link{antibiotics} data set for any column containing a name or code of that antibiotic. \strong{Longer columns names take precedence over shorter column names.}
|
||||
}
|
||||
\examples{
|
||||
df <- data.frame(amox = "S",
|
||||
tetr = "R")
|
||||
df <- data.frame(
|
||||
amox = "S",
|
||||
tetr = "R"
|
||||
)
|
||||
|
||||
guess_ab_col(df, "amoxicillin")
|
||||
# [1] "amox"
|
||||
@ -43,8 +45,10 @@ guess_ab_col(df, "J01AA07", verbose = TRUE)
|
||||
# [1] "tetr"
|
||||
|
||||
# WHONET codes
|
||||
df <- data.frame(AMP_ND10 = "R",
|
||||
AMC_ED20 = "S")
|
||||
df <- data.frame(
|
||||
AMP_ND10 = "R",
|
||||
AMC_ED20 = "S"
|
||||
)
|
||||
guess_ab_col(df, "ampicillin")
|
||||
# [1] "AMP_ND10"
|
||||
guess_ab_col(df, "J01CR02")
|
||||
@ -53,8 +57,10 @@ guess_ab_col(df, as.ab("augmentin"))
|
||||
# [1] "AMC_ED20"
|
||||
|
||||
# Longer names take precendence:
|
||||
df <- data.frame(AMP_ED2 = "S",
|
||||
AMP_ED20 = "S")
|
||||
df <- data.frame(
|
||||
AMP_ED2 = "S",
|
||||
AMP_ED20 = "S"
|
||||
)
|
||||
guess_ab_col(df, "ampicillin")
|
||||
# [1] "AMP_ED20"
|
||||
}
|
||||
|
Reference in New Issue
Block a user