From 373e0cb32f729b84c0a6b6e30ca5c74fa5d75320 Mon Sep 17 00:00:00 2001 From: "Matthijs S. Berends" Date: Fri, 16 Nov 2018 21:57:55 +0100 Subject: [PATCH] unit test fail --- R/freq.R | 9 ++++++++- tests/testthat/test-mdro.R | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/R/freq.R b/R/freq.R index 5a5693d5..9253cc4d 100755 --- a/R/freq.R +++ b/R/freq.R @@ -543,7 +543,8 @@ diff.frequency_tbl <- function(x, y, ...) { #' @importFrom dplyr n_distinct #' @importFrom crayon bold silver #' @export -print.frequency_tbl <- function(x, nmax = getOption("max.print.freq", default = 15), ...) { +print.frequency_tbl <- function(x, nmax = getOption("max.print.freq", default = 15), + markdown = !nteractive(), header = !markdown, ...) { opt <- attr(x, 'opt') @@ -584,6 +585,12 @@ print.frequency_tbl <- function(x, nmax = getOption("max.print.freq", default = opt$tbl_format <- "pandoc" } } + if (!missing(markdown)) { + opt$tbl_format <- "markdown" + } + if (!missing(header)) { + opt$header <- header + } if (trimws(title) == "") { title <- "Frequency table" diff --git a/tests/testthat/test-mdro.R b/tests/testthat/test-mdro.R index 4210cb99..d15c2a8b 100755 --- a/tests/testthat/test-mdro.R +++ b/tests/testthat/test-mdro.R @@ -20,7 +20,7 @@ test_that("mdro works", { # septic_patients should have these finding using Dutch guidelines expect_equal(outcome %>% freq() %>% pull(count), - c(19989, 9, 2)) # 1167 not eval., 817 neg, 14 pos, 2 unconfirmed + c(1989, 9, 2)) # 1989 neg, 9 pos, 2 unconfirmed expect_equal(brmo(septic_patients, info = FALSE), mdro(septic_patients, "nl", info = FALSE))