pretty_cuts.Rd
Function removing set notation used by cut
or by cut2
.
pretty_cuts(cut_str, only_cuts = FALSE)
cut_str | A character or factor vector produced by |
---|---|
only_cuts | A logical, defaults to |
A character vector.
For a factor generated by cut2
"[2057,2652)", "[2652,3092)", "..."
the function will return a character vector
"2057 - 2651", "2652 - 3091", "..."
The following function was referenced on Stacks Overflow on a number of occasions, in reference to obtaining nicer cuts, improving function performance and reducing small groups. The linked discussion provide a more comprehensive solutions than the function offered in this package.
#> [1] "1 - 4" "5 - 8" "3 - 6" "7 - 1" "7 - 1" "3 - 2" "3 - 6" "7 - 1" "3 - 6" #> [10] "3 - 6" "7 - 1" "3 - 6" "5 - 8" "3 - 6" "3 - 2" "7 - 1" "1 - 4" "3 - 2" #> [19] "1 - 4" "7 - 1" "7 - 1" "5 - 8" "5 - 8" "7 - 1" "5 - 8" "5 - 8" "3 - 6" #> [28] "3 - 6" "1 - 4" "3 - 2" "7 - 1" "7 - 1" "5 - 8" "5 - 8" "3 - 2" "3 - 6" #> [37] "5 - 8" "1 - 4" "1 - 4" "1 - 4" "3 - 2" "3 - 6" "3 - 6" "1 - 4" "3 - 2" #> [46] "3 - 2" "1 - 4" "3 - 6" "1 - 4" "7 - 1" "3 - 2" "3 - 6" "5 - 8" "3 - 2" #> [55] "3 - 6" "1 - 4" "3 - 2" "5 - 8" "7 - 1" "1 - 4" "5 - 8" "3 - 2" "1 - 4" #> [64] "1 - 4" "7 - 1" "3 - 6" "7 - 1" "7 - 1" "5 - 8" "3 - 6" "5 - 8" "5 - 8" #> [73] "5 - 8" "3 - 2" "3 - 6" "1 - 4" "1 - 4" "5 - 8" "1 - 4" "3 - 2" "1 - 4" #> [82] "5 - 8" "3 - 6" "5 - 8" "3 - 2" "3 - 6" "7 - 1" "7 - 1" "7 - 1" "3 - 2" #> [91] "3 - 2" "5 - 8" "1 - 4" "5 - 8" "1 - 4" "3 - 2" "5 - 8" "3 - 2" "3 - 6" #> [100] "3 - 6" "5 - 8" "1 - 4" "3 - 6" "7 - 1" "3 - 6" "7 - 1" "7 - 1" "5 - 8" #> [109] "3 - 6" "3 - 2" "7 - 1" "1 - 4" "3 - 2" "7 - 1" "5 - 8" "3 - 2" "3 - 6" #> [118] "7 - 1" "3 - 6" "3 - 6" "5 - 8" "1 - 4" "1 - 4" "1 - 4" "1 - 4" "7 - 1" #> [127] "3 - 2" "3 - 2" "3 - 2" "5 - 8" "5 - 8" "7 - 1" "5 - 8" "5 - 8" "3 - 6" #> [136] "5 - 8" "7 - 1" "5 - 8" "7 - 1" "3 - 6" "1 - 4" "3 - 6" "3 - 2" "3 - 2" #> [145] "7 - 1" "1 - 4" "1 - 4" "3 - 2" "1 - 4" "5 - 8" "7 - 1" "3 - 6" "1 - 4" #> [154] "1 - 4" "3 - 2" "1 - 4" "3 - 6" "1 - 4" "3 - 6" "1 - 4" "3 - 6" "1 - 4" #> [163] "5 - 8" "1 - 4" "1 - 4" "3 - 6" "5 - 8" "1 - 4" "3 - 6" "1 - 4" "5 - 8" #> [172] "3 - 2" "7 - 1" "5 - 8" "5 - 8" "5 - 8" "1 - 4" "3 - 6" "7 - 1" "3 - 6" #> [181] "7 - 1" "1 - 4" "5 - 8" "1 - 4" "3 - 6" "3 - 6" "1 - 4" "3 - 6" "7 - 1" #> [190] "7 - 1" "1 - 4" "1 - 4" "7 - 1" "5 - 8" "7 - 1" "3 - 6" "3 - 6" "5 - 8" #> [199] "3 - 2" "3 - 6" "1 - 4" "7 - 1" "5 - 8" "3 - 6" "3 - 6" "7 - 1" "1 - 4" #> [208] "1 - 4" "3 - 2" "3 - 2" "3 - 6" "1 - 4" "1 - 4" "5 - 8" "3 - 2" "5 - 8" #> [217] "1 - 4" "3 - 6" "7 - 1" "7 - 1" "1 - 4" "7 - 1" "5 - 8" "5 - 8" "3 - 2" #> [226] "1 - 4" "3 - 6" "3 - 6" "5 - 8" "7 - 1" "5 - 8" "3 - 6" "3 - 6" "3 - 2" #> [235] "1 - 4" "1 - 4" "3 - 2" "7 - 1" "3 - 2" "7 - 1" "3 - 6" "5 - 8" "3 - 2" #> [244] "5 - 8" "1 - 4" "5 - 8" "1 - 4" "7 - 1" "7 - 1" "5 - 8" "1 - 4" "1 - 4" #> [253] "3 - 6" "1 - 4" "3 - 6" "5 - 8" "3 - 2" "3 - 6" "3 - 6" "7 - 1" "7 - 1" #> [262] "7 - 1" "5 - 8" "7 - 1" "3 - 6" "3 - 6" "1 - 4" "1 - 4" "3 - 2" "3 - 6" #> [271] "7 - 1" "3 - 2" "3 - 2" "3 - 2" "5 - 8" "5 - 8" "7 - 1" "3 - 6" "3 - 2" #> [280] "5 - 8" "5 - 8" "3 - 2" "1 - 4" "1 - 4" "3 - 2" "1 - 4" "3 - 2" "1 - 4" #> [289] "3 - 2" "5 - 8" "1 - 4" "3 - 2" "3 - 2" "7 - 1" "5 - 8" "7 - 1" "7 - 1" #> [298] "3 - 2" "3 - 2" "5 - 8" "5 - 8" "3 - 2" "5 - 8" "5 - 8" "5 - 8" "3 - 6" #> [307] "3 - 2" "3 - 2" "3 - 6" "3 - 6" "1 - 4" "3 - 6" "5 - 8" "3 - 2" "1 - 4" #> [316] "7 - 1" "7 - 1" "1 - 4" "1 - 4" "7 - 1" "7 - 1" "1 - 4" "3 - 2" "5 - 8" #> [325] "3 - 2" "3 - 2" "7 - 1" "3 - 2" "1 - 4" "7 - 1" "5 - 8" "1 - 4" "5 - 8" #> [334] "7 - 1" "1 - 4" "3 - 6" "5 - 8" "5 - 8" "5 - 8" "7 - 1" "3 - 6" "3 - 2" #> [343] "3 - 6" "1 - 4" "3 - 6" "1 - 4" "7 - 1" "1 - 4" "1 - 4" "5 - 8" "3 - 2" #> [352] "7 - 1" "3 - 6" "3 - 2" "5 - 8" "7 - 1" "5 - 8" "3 - 6" "1 - 4" "7 - 1" #> [361] "3 - 2" "3 - 2" "7 - 1" "1 - 4" "1 - 4" "5 - 8" "3 - 2" "3 - 2" "3 - 6" #> [370] "3 - 6" "3 - 6" "1 - 4" "7 - 1" "3 - 6" "3 - 6" "7 - 1" "5 - 8" "1 - 4" #> [379] "1 - 4" "7 - 1" "3 - 6" "5 - 8" "1 - 4" "5 - 8" "3 - 6" "7 - 1" "3 - 2" #> [388] "1 - 4" "3 - 2" "1 - 4" "7 - 1" "1 - 4" "5 - 8" "5 - 8" "3 - 2" "1 - 4" #> [397] "1 - 4" "3 - 2" "3 - 2" "7 - 1" "7 - 1" "3 - 2" "7 - 1" "3 - 6" "1 - 4" #> [406] "3 - 6" "5 - 8" "3 - 2" "1 - 4" "5 - 8" "1 - 4" "7 - 1" "1 - 4" "3 - 6" #> [415] "1 - 4" "3 - 2" "7 - 1" "1 - 4" "3 - 6" "3 - 2" "3 - 6" "5 - 8" "3 - 6" #> [424] "1 - 4" "7 - 1" "5 - 8" "1 - 4" "1 - 4" "3 - 2" "7 - 1" "7 - 1" "3 - 6" #> [433] "1 - 4" "7 - 1" "1 - 4" "5 - 8" "3 - 2" "3 - 6" "3 - 2" "3 - 2" "1 - 4" #> [442] "3 - 6" "5 - 8" "3 - 2" "7 - 1" "5 - 8" "5 - 8" "3 - 2" "1 - 4" "5 - 8" #> [451] "3 - 6" "1 - 4" "1 - 4" "3 - 2" "1 - 4" "7 - 1" "7 - 1" "5 - 8" "3 - 2" #> [460] "3 - 2" "7 - 1" "3 - 6" "3 - 6" "3 - 2" "3 - 6" "1 - 4" "1 - 4" "5 - 8" #> [469] "1 - 4" "7 - 1" "3 - 2" "7 - 1" "3 - 6" "5 - 8" "5 - 8" "3 - 6" "5 - 8" #> [478] "3 - 2" "1 - 4" "5 - 8" "1 - 4" "7 - 1" "1 - 4" "5 - 8" "7 - 1" "3 - 2" #> [487] "3 - 2" "5 - 8" "3 - 6" "7 - 1" "7 - 1" "3 - 2" "3 - 6" "5 - 8" "3 - 2" #> [496] "7 - 1" "1 - 4" "3 - 2" "5 - 8" "5 - 8" "1 - 4" "1 - 4" "1 - 4" "3 - 2" #> [505] "1 - 4" "3 - 2" "3 - 6" "3 - 6" "7 - 1" "1 - 4" "3 - 6" "3 - 2" "7 - 1" #> [514] "1 - 4" "5 - 8" "3 - 2" "3 - 6" "5 - 8" "3 - 2" "7 - 1" "1 - 4" "1 - 4" #> [523] "1 - 4" "3 - 2" "3 - 6" "5 - 8" "7 - 1" "3 - 2" "7 - 1" "1 - 4" "7 - 1" #> [532] "5 - 8" "3 - 6" "7 - 1" "3 - 2" "5 - 8" "1 - 4" "7 - 1" "3 - 6" "1 - 4" #> [541] "7 - 1" "3 - 2" "7 - 1" "1 - 4" "5 - 8" "7 - 1" "3 - 2" "7 - 1" "7 - 1" #> [550] "1 - 4" "1 - 4" "1 - 4" "3 - 6" "7 - 1" "3 - 6" "3 - 6" "5 - 8" "3 - 6" #> [559] "3 - 6" "3 - 2" "3 - 2" "7 - 1" "5 - 8" "1 - 4" "5 - 8" "5 - 8" "1 - 4" #> [568] "7 - 1" "3 - 6" "7 - 1" "3 - 6" "7 - 1" "3 - 6" "3 - 6" "7 - 1" "5 - 8" #> [577] "3 - 6" "3 - 2" "3 - 6" "3 - 6" "7 - 1" "7 - 1" "7 - 1" "1 - 4" "7 - 1" #> [586] "3 - 2" "1 - 4" "5 - 8" "7 - 1" "3 - 6" "3 - 6" "3 - 2" "7 - 1" "3 - 2" #> [595] "3 - 2" "7 - 1" "3 - 6" "1 - 4" "7 - 1" "3 - 2" "1 - 4" "5 - 8" "1 - 4" #> [604] "1 - 4" "3 - 2" "7 - 1" "3 - 2" "7 - 1" "1 - 4" "1 - 4" "5 - 8" "3 - 2" #> [613] "3 - 2" "7 - 1" "3 - 6" "5 - 8" "7 - 1" "5 - 8" "7 - 1" "3 - 2" "7 - 1" #> [622] "7 - 1" "5 - 8" "1 - 4" "3 - 2" "1 - 4" "1 - 4" "7 - 1" "1 - 4" "1 - 4" #> [631] "5 - 8" "7 - 1" "3 - 6" "5 - 8" "3 - 2" "1 - 4" "7 - 1" "5 - 8" "7 - 1" #> [640] "3 - 6" "3 - 6" "5 - 8" "7 - 1" "1 - 4" "3 - 2" "5 - 8" "5 - 8" "3 - 2" #> [649] "1 - 4" "5 - 8" "5 - 8" "7 - 1" "3 - 6" "3 - 6" "5 - 8" "7 - 1" "7 - 1" #> [658] "3 - 2" "3 - 6" "1 - 4" "7 - 1" "7 - 1" "3 - 2" "5 - 8" "1 - 4" "3 - 2" #> [667] "7 - 1" "3 - 2" "5 - 8" "3 - 2" "3 - 2" "3 - 6" "3 - 2" "1 - 4" "3 - 6" #> [676] "3 - 6" "7 - 1" "1 - 4" "3 - 6" "3 - 6" "5 - 8" "5 - 8" "7 - 1" "7 - 1" #> [685] "7 - 1" "3 - 6" "3 - 6" "3 - 2" "3 - 6" "1 - 4" "3 - 2" "5 - 8" "3 - 6" #> [694] "3 - 2" "1 - 4" "3 - 6" "3 - 2" "3 - 2" "3 - 6" "1 - 4" "7 - 1" "1 - 4" #> [703] "3 - 2" "7 - 1" "1 - 4" "5 - 8" "3 - 6" "1 - 4" "3 - 2" "3 - 6" "5 - 8" #> [712] "3 - 6" "5 - 8" "5 - 8" "3 - 6" "1 - 4" "3 - 2" "3 - 2" "7 - 1" "3 - 2" #> [721] "3 - 6" "5 - 8" "5 - 8" "7 - 1" "5 - 8" "5 - 8" "7 - 1" "5 - 8" "5 - 8" #> [730] "3 - 2" "3 - 6" "7 - 1" "5 - 8" "7 - 1" "3 - 2" "1 - 4" "7 - 1" "7 - 1" #> [739] "1 - 4" "3 - 2" "7 - 1" "3 - 2" "3 - 2" "3 - 6" "1 - 4" "3 - 6" "5 - 8" #> [748] "3 - 2" "5 - 8" "7 - 1" "1 - 4" "1 - 4" "3 - 2" "3 - 2" "3 - 6" "3 - 6" #> [757] "3 - 6" "7 - 1" "3 - 2" "1 - 4" "3 - 6" "1 - 4" "3 - 6" "3 - 6" "3 - 6" #> [766] "3 - 2" "3 - 2" "3 - 6" "5 - 8" "5 - 8" "7 - 1" "7 - 1" "5 - 8" "7 - 1" #> [775] "3 - 2" "1 - 4" "1 - 4" "3 - 6" "5 - 8" "7 - 1" "1 - 4" "7 - 1" "3 - 2" #> [784] "5 - 8" "7 - 1" "3 - 6" "1 - 4" "3 - 2" "1 - 4" "7 - 1" "7 - 1" "3 - 6" #> [793] "1 - 4" "3 - 6" "7 - 1" "3 - 6" "3 - 2" "1 - 4" "1 - 4" "1 - 4" "3 - 6" #> [802] "1 - 4" "3 - 2" "3 - 2" "1 - 4" "7 - 1" "3 - 6" "3 - 6" "5 - 8" "5 - 8" #> [811] "3 - 2" "5 - 8" "1 - 4" "7 - 1" "5 - 8" "3 - 2" "1 - 4" "3 - 2" "3 - 6" #> [820] "3 - 6" "5 - 8" "1 - 4" "5 - 8" "7 - 1" "5 - 8" "3 - 2" "3 - 6" "3 - 2" #> [829] "1 - 4" "5 - 8" "3 - 2" "5 - 8" "3 - 6" "5 - 8" "5 - 8" "3 - 6" "5 - 8" #> [838] "5 - 8" "1 - 4" "3 - 2" "7 - 1" "5 - 8" "5 - 8" "3 - 2" "3 - 6" "1 - 4" #> [847] "7 - 1" "3 - 2" "1 - 4" "3 - 2" "1 - 4" "5 - 8" "7 - 1" "5 - 8" "3 - 6" #> [856] "3 - 6" "7 - 1" "3 - 2" "3 - 2" "7 - 1" "3 - 6" "3 - 2" "5 - 8" "3 - 6" #> [865] "5 - 8" "1 - 4" "3 - 2" "3 - 2" "3 - 6" "3 - 6" "3 - 2" "3 - 2" "5 - 8" #> [874] "3 - 6" "7 - 1" "5 - 8" "3 - 2" "5 - 8" "7 - 1" "5 - 8" "3 - 2" "7 - 1" #> [883] "5 - 8" "3 - 2" "5 - 8" "7 - 1" "3 - 6" "1 - 4" "1 - 4" "1 - 4" "3 - 6" #> [892] "5 - 8" "5 - 8" "3 - 6" "7 - 1" "5 - 8" "3 - 2" "1 - 4" "3 - 2" "5 - 8" #> [901] "7 - 1" "3 - 6" "7 - 1" "3 - 6" "5 - 8" "3 - 6" "5 - 8" "7 - 1" "7 - 1" #> [910] "3 - 2" "3 - 2" "3 - 2" "7 - 1" "3 - 6" "1 - 4" "7 - 1" "3 - 6" "3 - 6" #> [919] "1 - 4" "1 - 4" "7 - 1" "3 - 2" "1 - 4" "7 - 1" "5 - 8" "5 - 8" "1 - 4" #> [928] "3 - 6" "3 - 2" "5 - 8" "7 - 1" "1 - 4" "5 - 8" "3 - 6" "7 - 1" "3 - 2" #> [937] "3 - 6" "7 - 1" "7 - 1" "3 - 2" "7 - 1" "3 - 6" "1 - 4" "3 - 6" "3 - 2" #> [946] "3 - 2" "3 - 6" "1 - 4" "3 - 6" "1 - 4" "3 - 6" "3 - 2" "7 - 1" "3 - 2" #> [955] "1 - 4" "7 - 1" "5 - 8" "3 - 2" "3 - 6" "3 - 6" "3 - 6" "3 - 6" "5 - 8" #> [964] "3 - 2" "7 - 1" "3 - 6" "3 - 6" "3 - 2" "5 - 8" "3 - 6" "5 - 8" "3 - 2" #> [973] "7 - 1" "1 - 4" "1 - 4" "5 - 8" "7 - 1" "3 - 2" "1 - 4" "3 - 6" "3 - 6" #> [982] "5 - 8" "7 - 1" "5 - 8" "7 - 1" "5 - 8" "3 - 2" "3 - 2" "3 - 2" "3 - 6" #> [991] "3 - 2" "1 - 4" "3 - 6" "3 - 6" "3 - 6" "7 - 1" "5 - 8" "1 - 4" "5 - 8" #> [1000] "3 - 2"