A Japanese kitchen knife.
An R package for cutting data.
## x y
## 1 763 359
## 2 1037 253
## 3 989 197
## 4 1048 235
## 5 840 276
## 6 732 123
chop()chop() is a replacement for base R’s cut()
function.
chop()extend = FALSEchop_width()Chops fixed-width intervals
chop_evenly()Chops intervals equal-width intervals
chop_proportions()Chops intervals by proportions of the data range
chop_equally()Chops intervals with an equal number of elements
chop_n()Chops intervals with a fixed number of elements
chop_quantiles()| Chop by: / Size means: | number of elements | width |
|---|---|---|
| Fixed size | chop_n() |
chop_width() |
| Fixed no. of groups | chop_equally() |
chop_evenly() |
| Specific sizes | chop_quantiles() |
chop_proportions() |
chop_mean_sd()## [70, 300) [300, 600) [600, 900) [900, 1380]
## 8 53 42 158
## [-3 sd, -2 sd) [-2 sd, -1 sd) [-1 sd, 0 sd) [0 sd, 1 sd) [1 sd, 2 sd)
## 7 51 51 99 53
You need one more labels than breaks:
Not sure how many intervals you will have?
Use a lbl_* function.
Not sure how many intervals you will have?
Use a lbl_* function.
Not sure how many intervals you will have?
Use a lbl_* function.
Breaks are closed on the left by default.
For right-closed breaks use left = FALSE:
Sometimes it’s impossible to create the breaks you want.
## [1] [-∞, ∞] [-∞, ∞]
## Levels: [-∞, ∞]
When the problem comes from the data (x), santoku
will try to carry on (e.g. by returning a single interval).
When the problem comes from other parameters,
e.g. breaks or extend, santoku will give an
error.
## Error:
## ! probs contains 1 missing values
https://hughjonesd.github.io/santoku