{"version":"1.0","type":"rich","title":"Add a quantile column to a data.table","description":"This example shows how to add a quantile-based categorical column to a data.table in R. The code uses the `data.table` package’s `setDT` and `:=` syntax to create a new `quartile` column by applying `cut` to the `value` column, with breaks defined by `quantile` at 0%, 25%, 50%, 75%, and 100% probabilities. The `right = FALSE` argument assigns values to intervals closed on the left, and labels `1:4` mark the four quartile groups. The result is a modified data.table where each row is assigned a quartile number based on its value’s position in the distribution.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-766dd21825f38cc687fab5ef61fb9255?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}