Skip to content

Commit

Permalink
Safety update.
Browse files Browse the repository at this point in the history
  • Loading branch information
NicChr committed Oct 8, 2024
1 parent fd30702 commit a8a7f06
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/as_discrete.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ as_discrete.numeric <- function(
breaks <- na_rm(breaks)
# N breaks
nb <- length(breaks)

if (nb == 0){
stop("Please provide at least 1 valid break")
}

# N intervals = N breaks - 1
nintv <- max(nb - 1L, as.integer(include_endpoint))

Expand Down

0 comments on commit a8a7f06

Please sign in to comment.