Equal frequency discretization in R

前端 未结 8 1554
南方客
南方客 2020-12-17 02:56

I\'m having trouble finding a function in R that performs equal-frequency discretization. I stumbled on the \'infotheo\' package, but after some testing I found that the al

8条回答
  •  南方客
    南方客 (楼主)
    2020-12-17 03:41

    We can use package cutr with feature what = "rough", the look of labels can be customized to taste :

    # devtools::install_github("moodymudskipper/cutr")
    library(cutr)
    smart_cut(c(1, 3, 2, 1, 2, 2), 2, "rough", brackets = NULL, sep="-")
    # [1] 1-2 2-3 1-2 1-2 2-3 2-3
    # Levels: 1-2 < 2-3
    

提交回复
热议问题