16.3 Cutting

16.3.1 chop()



cut() in base R

ntile() in dplyr:


If data is beyond the limits of breaks, they will be extended automatically, unless extend = FALSE, and values beyond the bounds will be converted to NA:

To chop a single number into a separate category, put the number twice in breaks:

To quickly produce a table of chopped data, use tab():