mirror of
https://github.com/msberends/AMR.git
synced 2025-07-12 19:41:58 +02:00
styled, unit test fix
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
# (c) 2018-2022 Berends MS, Luz CF et al. #
|
||||
# Developed at the University of Groningen, the Netherlands, in #
|
||||
# collaboration with non-profit organisations Certe Medical #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# Diagnostics & Advice, and University Medical Center Groningen. #
|
||||
# #
|
||||
# This R package is free software; you can freely use and distribute #
|
||||
# it for both personal and commercial purposes under the terms of the #
|
||||
@ -23,20 +23,26 @@
|
||||
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
|
||||
# ==================================================================== #
|
||||
|
||||
resistance_data <- structure(list(order = c("Bacillales", "Enterobacterales", "Enterobacterales"),
|
||||
genus = c("Staphylococcus", "Escherichia", "Klebsiella"),
|
||||
AMC = c(0.00425, 0.13062, 0.10344),
|
||||
CXM = c(0.00425, 0.05376, 0.10344),
|
||||
CTX = c(0.00000, 0.02396, 0.05172),
|
||||
TOB = c(0.02325, 0.02597, 0.10344),
|
||||
TMP = c(0.08387, 0.39141, 0.18367)),
|
||||
class = c("grouped_df", "tbl_df", "tbl", "data.frame"),
|
||||
row.names = c(NA, -3L),
|
||||
groups = structure(list(order = c("Bacillales", "Enterobacterales"),
|
||||
.rows = list(1L, 2:3)),
|
||||
row.names = c(NA, -2L),
|
||||
class = c("tbl_df", "tbl", "data.frame"),
|
||||
.drop = TRUE))
|
||||
resistance_data <- structure(list(
|
||||
order = c("Bacillales", "Enterobacterales", "Enterobacterales"),
|
||||
genus = c("Staphylococcus", "Escherichia", "Klebsiella"),
|
||||
AMC = c(0.00425, 0.13062, 0.10344),
|
||||
CXM = c(0.00425, 0.05376, 0.10344),
|
||||
CTX = c(0.00000, 0.02396, 0.05172),
|
||||
TOB = c(0.02325, 0.02597, 0.10344),
|
||||
TMP = c(0.08387, 0.39141, 0.18367)
|
||||
),
|
||||
class = c("grouped_df", "tbl_df", "tbl", "data.frame"),
|
||||
row.names = c(NA, -3L),
|
||||
groups = structure(list(
|
||||
order = c("Bacillales", "Enterobacterales"),
|
||||
.rows = list(1L, 2:3)
|
||||
),
|
||||
row.names = c(NA, -2L),
|
||||
class = c("tbl_df", "tbl", "data.frame"),
|
||||
.drop = TRUE
|
||||
)
|
||||
)
|
||||
pca_model <- pca(resistance_data)
|
||||
expect_inherits(pca_model, "pca")
|
||||
|
||||
@ -48,14 +54,16 @@ if (AMR:::pkg_is_available("ggplot2")) {
|
||||
}
|
||||
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
|
||||
resistance_data <- example_isolates %>%
|
||||
group_by(order = mo_order(mo),
|
||||
genus = mo_genus(mo)) %>%
|
||||
resistance_data <- example_isolates %>%
|
||||
group_by(
|
||||
order = mo_order(mo),
|
||||
genus = mo_genus(mo)
|
||||
) %>%
|
||||
summarise_if(is.rsi, resistance, minimum = 0)
|
||||
pca_result <- resistance_data %>%
|
||||
pca(AMC, CXM, CTX, CAZ, GEN, TOB, TMP, "SXT")
|
||||
pca_result <- resistance_data %>%
|
||||
pca(AMC, CXM, CTX, CAZ, GEN, TOB, TMP, "SXT")
|
||||
expect_inherits(pca_result, "prcomp")
|
||||
|
||||
|
||||
if (AMR:::pkg_is_available("ggplot2")) {
|
||||
ggplot_pca(pca_result, ellipse = TRUE)
|
||||
ggplot_pca(pca_result, ellipse = FALSE, arrows_textangled = FALSE, scale = FALSE)
|
||||
|
Reference in New Issue
Block a user