Skip to content

Commit

Permalink
allow NA values
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed May 26, 2024
1 parent 6c7e801 commit cddbae9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: insight
Title: Easy Access to Model Information for Various Model Objects
Version: 0.19.11.2
Version: 0.19.11.3
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ S3method(format_ci,bayestestR_ci)
S3method(format_ci,character)
S3method(format_ci,data.frame)
S3method(format_ci,factor)
S3method(format_ci,logical)
S3method(format_ci,numeric)
S3method(format_string,character)
S3method(format_string,data.frame)
Expand Down
6 changes: 6 additions & 0 deletions R/format_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ format_ci <- function(CI_low, ...) {
}


#' @export
format_ci.logical <- function(CI_low, ...) {
""
}


#' @rdname format_ci
#' @export
format_ci.numeric <- function(CI_low,
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test-format_table_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ test_that("format_table with multiple si-levels", {
})


test_that("format_table with NA values", {
d <- data.frame(
a = 1,
CI = 0.95,
CI_low = NA,
CI_high = NA
)
ft <- insight::format_table(d)
expect_identical(ft[["95% CI"]], "")
})


skip_if_not_installed("bayestestR")
set.seed(1234)
test_that("format_table with multiple si-levels", {
Expand Down

0 comments on commit cddbae9

Please sign in to comment.