1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 18:41:58 +02:00

con WHONET, filter ab class

This commit is contained in:
2019-03-05 22:47:42 +01:00
parent e835525cf6
commit 74e0ae21fd
73 changed files with 1174 additions and 375 deletions

View File

@ -0,0 +1,44 @@
# ==================================================================== #
# TITLE #
# Antimicrobial Resistance (AMR) Analysis #
# #
# SOURCE #
# https://gitlab.com/msberends/AMR #
# #
# LICENCE #
# (c) 2019 Berends MS (m.s.berends@umcg.nl), Luz CF (c.f.luz@umcg.nl) #
# #
# This R package is free software; you can freely use and distribute #
# it for both personal and commercial purposes under the terms of the #
# GNU General Public License version 2.0 (GNU GPL-2), as published by #
# the Free Software Foundation. #
# #
# This R package was created for academic research and was publicly #
# released in the hope that it will be useful, but it comes WITHOUT #
# ANY WARRANTY OR LIABILITY. #
# Visit our website for more info: https://msberends.gitab.io/AMR. #
# ==================================================================== #
context("filter_ab_class.R")
test_that("ATC-group filtering works", {
library(dplyr)
expect_gt(septic_patients %>% filter_ab_class("carbapenem") %>% nrow(), 0)
expect_gt(septic_patients %>% filter_aminoglycosides() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_carbapenems() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_cephalosporins() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_1st_cephalosporins() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_2nd_cephalosporins() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_3rd_cephalosporins() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_4th_cephalosporins() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_fluoroquinolones() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_glycopeptides() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_macrolides() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_tetracyclines() %>% nrow(), 0)
expect_gt(septic_patients %>% filter_carbapenems("R", "all") %>% nrow(), 0)
expect_error(septic_patients %>% filter_carbapenems(result = "test"))
expect_error(septic_patients %>% filter_carbapenems(scope = "test"))
expect_warning(septic_patients %>% select(1:3) %>% filter_carbapenems())
})