1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 11:51:59 +02:00

quasiquotation for freq()

This commit is contained in:
2019-01-28 11:20:32 +01:00
parent 63e343d555
commit f6336fdd89
15 changed files with 550 additions and 136 deletions

View File

@ -21,15 +21,15 @@
context("atc.R")
test_that("guess_atc works", {
expect_equal(as.character(guess_atc(c("J01FA01",
"Erythromycin",
"eryt",
"ERYT",
"ERY",
"Erythrocin",
"Eryzole",
"Pediamycin"))),
test_that("as.atc works", {
expect_equal(suppressWarnings(as.character(guess_atc(c("J01FA01",
"Erythromycin",
"eryt",
"ERYT",
"ERY",
"Erythrocin",
"Eryzole",
"Pediamycin")))),
rep("J01FA01", 8))
expect_identical(class(as.atc("amox")), "atc")

View File

@ -92,6 +92,12 @@ test_that("frequency table works", {
expect_output(print(septic_patients %>% group_by(gender) %>% freq(amox, quote = TRUE)))
expect_output(print(septic_patients %>% group_by(gender) %>% freq(amox, markdown = TRUE)))
# quasiquotation
expect_output(print(septic_patients %>% freq(mo_genus(mo))))
expect_output(print(septic_patients %>% freq(mo, mo_genus(mo))))
expect_output(print(septic_patients %>% group_by(gender) %>% freq(mo_genus(mo))))
expect_output(print(septic_patients %>% group_by(gender) %>% freq(mo, mo_genus(mo))))
# top 5
expect_equal(
septic_patients %>%