Provide grouping tags for cut
Arguments
- breaks_list
data split points for grouping,such as
c(18,30,40,50,60,70,Inf)
- openr
default
openright= FALSE
,the data interval is in the form of left opening and right closing,such as[1,2)
.Whenopenright= TRUE
, the data interval is in the form of left closing and right opening.- digits
defines the number of decimal places for the return label.
Examples
breaks_age <- c(18,30,40,50,60,70,Inf)
cut_label(breaks_age)
#> [1] "[18,30)" "[30,40)" "[40,50)" "[50,60)" "[60,70)" "[70,+)"
cut_label(breaks_age,2)
#> [1] "(18,30]" "(30,40]" "(40,50]" "(50,60]" "(60,70]" "(70,+]"