Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cut_number Doesn't Work With Duplicated Values #1046

DarioS opened this issue Jan 21, 2015 · 1 comment

cut_number Doesn't Work With Duplicated Values #1046

DarioS opened this issue Jan 21, 2015 · 1 comment


Copy link

DarioS commented Jan 21, 2015

cut_number fails sometimes when there are duplicated values.

> cut_number(rep(1:5, 2), 10, labels = FALSE)
Error in cut.default(x, breaks(x, "n", n), include.lowest = TRUE, ...) : 'breaks' are not unique

This limitation should at least be stated in the documentation, but ideally changed to produce a meaningful result.

Copy link

hadley commented Jun 11, 2015

This is nothing to do with duplicated input - it's because you've asked for 10 bins with equal numbers of bins in them, and there are only 5 values

@hadley hadley closed this as completed in 1a4b08b Jun 11, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

No branches or pull requests

2 participants