mirror of
https://github.com/msberends/AMR.git
synced 2026-01-11 23:14:34 +01:00
(v3.0.1.9013) fix translations
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 3.0.1.9012
|
||||
Version: 3.0.1.9013
|
||||
Date: 2026-01-07
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
||||
2
NEWS.md
2
NEWS.md
@@ -1,4 +1,4 @@
|
||||
# AMR 3.0.1.9012
|
||||
# AMR 3.0.1.9013
|
||||
|
||||
### New
|
||||
* Integration with the **tidymodels** framework to allow seamless use of SIR, MIC and disk data in modelling pipelines via `recipes`
|
||||
|
||||
@@ -263,16 +263,17 @@ translate_into_language <- function(from,
|
||||
df_trans$pattern[df_trans$regular_expr == TRUE] <- gsub("$$", "$", df_trans$pattern[df_trans$regular_expr == TRUE], fixed = TRUE)
|
||||
}
|
||||
|
||||
df_trans_regex <- df_trans[which(df_trans$regular_expr == TRUE), ]
|
||||
# regex part
|
||||
lapply(
|
||||
# starting with longest pattern, since more general translations are shorter, such as 'Group'
|
||||
order(nchar(df_trans$pattern), decreasing = TRUE)[df_trans$regular_expr == TRUE],
|
||||
order(nchar(df_trans_regex$pattern), decreasing = TRUE),
|
||||
function(i) {
|
||||
from_unique_translated <<- gsub(
|
||||
pattern = df_trans$pattern[i],
|
||||
replacement = df_trans[i, lang, drop = TRUE],
|
||||
pattern = df_trans_regex$pattern[i],
|
||||
replacement = df_trans_regex[i, lang, drop = TRUE],
|
||||
x = from_unique_translated,
|
||||
ignore.case = !df_trans$case_sensitive[i],
|
||||
ignore.case = !df_trans_regex$case_sensitive[i],
|
||||
fixed = FALSE,
|
||||
perl = TRUE
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user