Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
hughjonesd committed Jun 11, 2024
1 parent bcd10a9 commit 4902715
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/breaks-by-group-size.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ brk_quantiles <- function (probs, ..., weights = NULL, recalc_probs = FALSE) {

if (anyNA(qs)) return(empty_breaks()) # data was all NA

if (any(duplicated(qs))) {
if (anyDuplicated(qs) > 0L) {
if (! recalc_probs) {
warning("`x` has duplicate quantiles: break labels may be misleading")
}
Expand Down
7 changes: 6 additions & 1 deletion R/breaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ brk_spikes <- function (breaks, n = NULL, prop = NULL) {
assert_that(
is.number(n) || is.number(prop),
is.null(n) || is.null(prop),
msg = "exactly one of `n` and `prop` must be specified as a scalar numeric"
msg = "exactly one of `n` and `prop` must be a scalar numeric"
)
assert_that(
# it's ok for one of these to be null
n >= 0 || prop >= 0
)

if (! is.function(breaks)) breaks <- brk_default(breaks)

function (x, extend, left, close_end) {
Expand Down
6 changes: 5 additions & 1 deletion R/chop-isolates.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ dissect <- function (x,
assert_that(
is.number(n) || is.number(prop),
is.null(n) || is.null(prop),
msg = "exactly one of `n` and `prop` must be specified as a scalar numeric"
msg = "exactly one of `n` and `prop` must be a scalar numeric"
)
assert_that(
# it's ok for one of these to be null
n >= 0 || prop >= 0
)

chopped <- chop(x, breaks, ...)
Expand Down

0 comments on commit 4902715

Please sign in to comment.