Skip to content

Commit

Permalink
puts a warning behind the verbose option, closes #138
Browse files Browse the repository at this point in the history
  • Loading branch information
markmfredrickson committed May 14, 2018
1 parent 9e1600b commit f6ef7f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/fullmatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,10 @@ fullmatch.matrix <- function(x,
attr(mout, "omit.fraction") <- out.omit.fraction
}

if(length(new.omit.fraction) > 0 & !identical(new.omit.fraction, omit.fraction) & !all(is.na(new.omit.fraction))) {
if(length(new.omit.fraction) > 0 &
!identical(new.omit.fraction, omit.fraction) &
!all(is.na(new.omit.fraction)) &
getOption("optmatch_verbose_messaging", FALSE)) {
if(!any(is.na(new.omit.fraction)) & all(new.omit.fraction == 1)) {
# If we never got a feasible subproblem
warning("The problem appears infeasible with the given constraints.")
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test.fullmatch.infeasible.recovery.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ test_that("Allow passing all NA to mean.controls or omit.fraction", {
})

test_that("Correctly apply max.controls", {
options("optmatch_verbose_messaging" = TRUE)

set.seed(2)
x <- runif(20)
fact <- c(rep(0,7), rep(1, 4), rep(2, 9))
Expand Down Expand Up @@ -149,6 +151,7 @@ test_that("Correctly apply max.controls", {
})

test_that("Omits occur only on controls", {
options("optmatch_verbose_messaging" = TRUE)
set.seed(3)
x <- runif(20)
fact <- c(rep(0,7), rep(1, 4), rep(2, 9))
Expand Down

0 comments on commit f6ef7f5

Please sign in to comment.