Sometimes you may want to analyze your numeric data (such as Age or Income) as categories instead of using the raw numeric values. This process goes by different names such as banding, categorizing, binning, and cutting, see Converting Numeric Variables into Categorical Variables for a walk through of this technique. There are multiple ways of doing this within Displayr depending on your needs:
- How to Band Numeric Variables using a Histogram - if you want to visually set and see the cut-offs for your categories, you can use a categorizable histogram to create categories based on the distribution of the data. This supports one or more variables, custom categories, equal proportions, and equal intervals. These cutoffs will stay in place if the data is updated, but you can also update the cutoffs based on the new data if you wish.
- How to Band Numeric Variables Using JavaScript - you can write JavaScript code to bucket your responses into custom categories using simple if-else logic, if you don't want to manually work with the histogram. Categories would need to be created using one variable at a time, but the code can be reused/modified for each numeric variable.
- How to Automatically Combine Categories - By Value - this automation creates categorical variables using a menu of options for how to band and label the categories. It supports various methods of binning the data, and can be set up to recalculate cut offs or have the bin cutoffs hardcoded. You can also use this automation across multiple variables. The categorical variables are created via R code under the hood, so if more customization is needed, you can edit the R code further.
- How to Band Numeric Variables Using R - you can write your own custom R code to band the responses into categories. Compared to using JavaScript code, R code more easily handles advanced mathematical calculations for binning, and can be used across multiple variables at once. Any calculations done within R (such as averages) will be recalculated automatically if the numeric data is updated.
- How to Band Numeric Variables using a Table - you can also simply merge together values on a table directly to create categories for them. One thing to keep in mind here though, is if there isn't a response in the data set for a value within a band, if that value shows up in the updated data, it will not be categorized (because it will not have been included initially with combining categories).