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

support for French and Italian, added quote to freq

This commit is contained in:
2018-09-10 15:45:25 +02:00
parent b83e6a9380
commit cb0d74a4f0
9 changed files with 81 additions and 18 deletions

View File

@ -20,6 +20,7 @@ test_that("frequency table works", {
expect_output(print(freq(septic_patients$age, markdown = TRUE), markdown = FALSE))
expect_output(print(freq(septic_patients$age, markdown = TRUE), markdown = TRUE))
expect_output(print(freq(septic_patients$age[0])))
expect_output(print(freq(septic_patients$age, quote = TRUE)))
# character
expect_output(print(freq(septic_patients$mo)))

View File

@ -16,13 +16,6 @@ test_that("mo_property works", {
expect_equal(mo_shortname("S. aga"), "S. agalactiae")
expect_equal(mo_shortname("S. aga", Lancefield = TRUE), "GBS")
expect_equal(mo_type("E. coli", language = "de"), "Bakterium")
expect_equal(mo_type("E. coli", language = "nl"), "Bacterie")
expect_equal(mo_gramstain("E. coli", language = "nl"), "Negatieve staven")
expect_error(mo_type("E. coli", language = "INVALID"))
# test integrity
library(dplyr)
MOs <- AMR::microorganisms %>% filter(!is.na(mo))
@ -45,4 +38,19 @@ test_that("mo_property works", {
expect_gt(sum(tb$c) / nrow(tb), 0.9) # more than 90% of MO code should be identical
expect_identical(sum(tb$f), nrow(tb)) # all shortnames should be identical
# check languages
expect_equal(mo_type("E. coli", language = "de"), "Bakterium")
expect_equal(mo_type("E. coli", language = "nl"), "Bacterie")
expect_equal(mo_gramstain("E. coli", language = "nl"), "Negatieve staven")
expect_output(print(mo_gramstain("E. coli", language = "en")))
expect_output(print(mo_gramstain("E. coli", language = "de")))
expect_output(print(mo_gramstain("E. coli", language = "nl")))
expect_output(print(mo_gramstain("E. coli", language = "es")))
expect_output(print(mo_gramstain("E. coli", language = "pt")))
expect_output(print(mo_gramstain("E. coli", language = "it")))
expect_output(print(mo_gramstain("E. coli", language = "fr")))
expect_error(mo_gramstain("E. coli", language = "UNKNOWN"))
})