Logical. Close last break at right? (If left is FALSE,
close first break at left?)
tail
String. What to do if the final interval has fewer than n elements?
"split" to keep it separate. "merge" to merge it with the neighbouring
interval.
Details
The algorithm guarantees that intervals contain no more than n elements, so
long as there are no duplicates in x and tail = "split". It also
guarantees that intervals contain no fewer than n elements, except possibly
the last interval (or first interval if left is FALSE).
To ensure that all intervals contain at least n elements (so long as there
are at least n elements in x!) set tail = "merge".
If tail = "split" and there are intervals containing duplicates with more
than n elements, a warning is given.
chop_n(1:10, 5)
chop_n(1:5, 2)
chop_n(1:5, 2, tail = "merge")
# too many duplicatesx <- rep(1:2, each = 3)
chop_n(x, 2)
tab_n(1:10, 5)
# fewer elements in one grouptab_n(1:10, 4)