mirror of
https://github.com/msberends/AMR.git
synced 2024-12-25 07:26:12 +01:00
N for only 1 AB in
This commit is contained in:
parent
551aaf6517
commit
a84101db08
@ -1,5 +1,5 @@
|
|||||||
Package: AMR
|
Package: AMR
|
||||||
Version: 1.8.2.9140
|
Version: 1.8.2.9141
|
||||||
Date: 2023-02-22
|
Date: 2023-02-22
|
||||||
Title: Antimicrobial Resistance Data Analysis
|
Title: Antimicrobial Resistance Data Analysis
|
||||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
|||||||
# AMR 1.8.2.9140
|
# AMR 1.8.2.9141
|
||||||
|
|
||||||
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*
|
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*
|
||||||
|
|
||||||
|
@ -188,12 +188,11 @@
|
|||||||
#' # with a custom language, though this will be determined automatically
|
#' # with a custom language, though this will be determined automatically
|
||||||
#' # (i.e., this table will be in Spanish on Spanish systems)
|
#' # (i.e., this table will be in Spanish on Spanish systems)
|
||||||
#' antibiogram(ex1,
|
#' antibiogram(ex1,
|
||||||
#' antibiotics = aminoglycosides(),
|
#' antibiotics = aminoglycosides(),
|
||||||
#' ab_transform = "name",
|
#' ab_transform = "name",
|
||||||
#' syndromic_group = ifelse(ex1$ward == "ICU",
|
#' syndromic_group = ifelse(ex1$ward == "ICU",
|
||||||
#' "UCI", "No UCI"
|
#' "UCI", "No UCI"),
|
||||||
#' ),
|
#' language = "es"
|
||||||
#' language = "es"
|
|
||||||
#' )
|
#' )
|
||||||
#'
|
#'
|
||||||
#'
|
#'
|
||||||
@ -201,13 +200,13 @@
|
|||||||
#'
|
#'
|
||||||
#' # the data set could contain a filter for e.g. respiratory specimens/ICU
|
#' # the data set could contain a filter for e.g. respiratory specimens/ICU
|
||||||
#' antibiogram(example_isolates,
|
#' antibiogram(example_isolates,
|
||||||
#' antibiotics = c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
|
#' antibiotics = c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
|
||||||
#' mo_transform = "gramstain",
|
#' mo_transform = "gramstain",
|
||||||
#' minimum = 10, # this should be >=30, but now just as example
|
#' minimum = 10, # this should be >=30, but now just as example
|
||||||
#' syndromic_group = ifelse(example_isolates$age >= 65 &
|
#' syndromic_group = ifelse(example_isolates$age >= 65 &
|
||||||
#' example_isolates$gender == "M",
|
#' example_isolates$gender == "M",
|
||||||
#' "WISCA Group 1", "WISCA Group 2"
|
#' "WISCA Group 1", "WISCA Group 2"
|
||||||
#' )
|
#' )
|
||||||
#' )
|
#' )
|
||||||
#'
|
#'
|
||||||
#' # Print the output for R Markdown / Quarto -----------------------------
|
#' # Print the output for R Markdown / Quarto -----------------------------
|
||||||
@ -488,8 +487,15 @@ antibiogram <- function(x,
|
|||||||
count_group <- n_per_mo$count[match(new_df[[1]], n_per_mo$mo)]
|
count_group <- n_per_mo$count[match(new_df[[1]], n_per_mo$mo)]
|
||||||
edit_col <- 1
|
edit_col <- 1
|
||||||
}
|
}
|
||||||
new_df[[edit_col]] <- paste0(new_df[[edit_col]], " (", count_group, ")")
|
if (NCOL(new_df) == edit_col + 1) {
|
||||||
colnames(new_df)[edit_col] <- paste(colnames(new_df)[edit_col], "(N min-max)")
|
# only 1 antibiotic
|
||||||
|
new_df[[edit_col]] <- paste0(new_df[[edit_col]], " (", unlist(lapply(strsplit(count_group, "-"), function(x) x[1])), ")")
|
||||||
|
colnames(new_df)[edit_col] <- paste(colnames(new_df)[edit_col], "(N)")
|
||||||
|
} else {
|
||||||
|
# more than 1 antibiotic
|
||||||
|
new_df[[edit_col]] <- paste0(new_df[[edit_col]], " (", count_group, ")")
|
||||||
|
colnames(new_df)[edit_col] <- paste(colnames(new_df)[edit_col], "(N min-max)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out <- as_original_data_class(new_df, class(x), extra_class = "antibiogram")
|
out <- as_original_data_class(new_df, class(x), extra_class = "antibiogram")
|
||||||
|
@ -217,12 +217,11 @@ ex1 <- example_isolates[which(mo_genus() == "Escherichia"), ]
|
|||||||
# with a custom language, though this will be determined automatically
|
# with a custom language, though this will be determined automatically
|
||||||
# (i.e., this table will be in Spanish on Spanish systems)
|
# (i.e., this table will be in Spanish on Spanish systems)
|
||||||
antibiogram(ex1,
|
antibiogram(ex1,
|
||||||
antibiotics = aminoglycosides(),
|
antibiotics = aminoglycosides(),
|
||||||
ab_transform = "name",
|
ab_transform = "name",
|
||||||
syndromic_group = ifelse(ex1$ward == "ICU",
|
syndromic_group = ifelse(ex1$ward == "ICU",
|
||||||
"UCI", "No UCI"
|
"UCI", "No UCI"),
|
||||||
),
|
language = "es"
|
||||||
language = "es"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -230,13 +229,13 @@ antibiogram(ex1,
|
|||||||
|
|
||||||
# the data set could contain a filter for e.g. respiratory specimens/ICU
|
# the data set could contain a filter for e.g. respiratory specimens/ICU
|
||||||
antibiogram(example_isolates,
|
antibiogram(example_isolates,
|
||||||
antibiotics = c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
|
antibiotics = c("AMC", "AMC+CIP", "TZP", "TZP+TOB"),
|
||||||
mo_transform = "gramstain",
|
mo_transform = "gramstain",
|
||||||
minimum = 10, # this should be >=30, but now just as example
|
minimum = 10, # this should be >=30, but now just as example
|
||||||
syndromic_group = ifelse(example_isolates$age >= 65 &
|
syndromic_group = ifelse(example_isolates$age >= 65 &
|
||||||
example_isolates$gender == "M",
|
example_isolates$gender == "M",
|
||||||
"WISCA Group 1", "WISCA Group 2"
|
"WISCA Group 1", "WISCA Group 2"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Print the output for R Markdown / Quarto -----------------------------
|
# Print the output for R Markdown / Quarto -----------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user