Skip to content

Commit

Permalink
Merge pull request #137 from n8thangreen/dev
Browse files Browse the repository at this point in the history
update to latest across main and dev branches
  • Loading branch information
n8thangreen authored Aug 9, 2023
2 parents 8757a60 + cf868d2 commit 84657f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions R/CreateInputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
createInputs.default <- function(inputs,
print_is_linear_comb = TRUE) {

# remove NA columns
if (sum(is.na(inputs)) > 0) {
inputs <- inputs[ , colSums(is.na(inputs)) == 0]
message("Dropped any columns containing NAs")
}

if (!is.logical(print_is_linear_comb))
stop("print_is_linear_comb must be logical.", call. = FALSE)

Expand Down
19 changes: 13 additions & 6 deletions tests/testthat/test-createInputs.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@


##TODO:





test_that("createInputs bad arguments", {

data(Vaccine, package = "BCEA")
treats <- c("Status quo", "Vaccination")

m <- bcea(e.pts, c.pts, ref = 2, interventions = treats)

dat <- vaccine_mat[, 1:5]
datNA <- cbind(dat, NA)

expect_equal(createInputs(dat), createInputs(datNA))
expect_message(createInputs(datNA), regexp = "Dropped any columns containing NAs")
})

0 comments on commit 84657f9

Please sign in to comment.