1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-10 23:01:58 +02:00

(v0.7.1.9092) as.ab() improvements

This commit is contained in:
2019-10-04 15:36:12 +02:00
parent edb599ae0b
commit 8bc4081b03
28 changed files with 176 additions and 71 deletions

View File

@ -53,6 +53,9 @@ test_that("as.ab works", {
expect_equal(suppressWarnings(as.character(as.ab(c("Bacteria", "Bacterial")))),
c(NA, "TMP"))
expect_equal(as.character(as.ab("Amoxy + clavulaanzuur")),
"AMC")
# assigning and subsetting
x <- antibiotics$ab

View File

@ -21,6 +21,16 @@
context("misc.R")
test_that("percentages works", {
expect_equal(percentage(0.25), "25%")
expect_equal(percentage(0.5), "50%")
expect_equal(percentage(0.500, digits = 1), "50.0%")
expect_equal(percentage(0.1234), "12.3%")
# round up 0.5
expect_equal(percentage(0.0054), "0.5%")
expect_equal(percentage(0.0055), "0.6%")
})
test_that("functions missing in older R versions work", {
expect_equal(strrep("A", 5), "AAAAA")
expect_equal(strrep(c("A", "B"), c(5, 2)), c("AAAAA", "BB"))