Skip to content

Commit

Permalink
support() default method now uses open limits when density fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Sep 17, 2024
1 parent 9e632cc commit 3fbf655
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/default.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ support.dist_default <- function(x, ...) {
closed <- if(any(is.na(lims))) {
c(FALSE, FALSE)
} else {
!near(density(x, lims), 0)
# Default to open limits on error
lim_dens <- tryCatch(density(x, lims), error = function(e) c(0,0))
!near(lim_dens, 0)
}
new_support_region(
list(vctrs::vec_init(generate(x, 1), n = 0L)),
Expand Down

0 comments on commit 3fbf655

Please sign in to comment.