ropensci / skimr

A frictionless, pipeable approach to dealing with summary statistics
https://docs.ropensci.org/skimr
1.1k stars 79 forks source link

Add bins to histogram? #686

Closed thisisnickb closed 2 years ago

thisisnickb commented 2 years ago

Not sure how easy this is to reprogram, but it would be very useful to be able to control the histogram output more finely, so that one could adjust the bin cutoffs, add additional bins, etc.

michaelquinn32 commented 2 years ago

Hi Nick!

Our histogram function is pretty simple, but you can set the number of bins: https://github.com/ropensci/skimr/blob/97d0fa9f26c8e98912ba4079c44210f7bd88f382/R/stats.R#L84

To change how the histogram works, you'll want to create a custom skim function

# Use 8 bins
my_skim <- skim_with(numeric = sfl(hist = ~ inline_hist(., 8)))

There are more details on customization in this vignette: https://github.com/ropensci/skimr/blob/97d0fa9f26c8e98912ba4079c44210f7bd88f382/vignettes/Supporting_additional_objects.Rmd#L109

Best wishes, Michael