There are many ways in which you can create a filter in Displayr, such as with our filtering tool interface, built-in automations, and also via custom code. The table below can be used as a guide on the best way to create filters based on the structure of your input variable(s) and how you'd like to use them to filter. The first column lists the different variable structures, while the second column details the filter's goal, and the third column provides the method to use.
If you want to learn more about filtering, in general, see Introduction to Filtering.
| Your filter data is: | You want: | What to do: |
| A Nominal variable (categorical) | A filter variable for each category | Use the Filters from Selected Data automation, see How to Create a Binary Filter from Selected Data |
| A Nominal variable (categorical) | A filter to filter in respondents who left any response | Assuming responses are coded with values above 0, just check Usable as Filter - see How to Tag a Variable as a Filter. |
| A Nominal or Nominal-Multi variable | A filter to filter in respondents who left specific responses (such as Like and Love for a Top 2 Box) | Change Structure > Binary-Multi, in Values > Count This Value for select categories and then click Usable as a filter. |
| A Binary-Multi variable | A filter for each variable | In the object inspector, check Usable as a filter, see How to Tag a Variable as a Filter |
| Across two variable sets |
Each variable in a set rebased according to matching variables in the other variable set OR Expand each category/variable in one variable set filtered by each category/variable in the other variable set |
How to Rebase One Question Based on Another Question |
| A variable set | To filter based on criteria | How to Create a Simple Filter or Use R Code to Create a Filter or Use JavaScript Code to Create a Filter |
| Across variable sets | To filter based on criteria from each | How to Create a Complicated Filter or Use R Code to Create a Filter or Use JavaScript Code to Create a Filter |
| A Date/Time variable | To filter in a specific range or the most recent X periods | Configure in the Date/Time > Period type using a Date range or Duration and then use How to Tag a Variable as a Filter. |
| Numeric | To filter in data based on a calculation across respondents or value of another variable set (note if the calculation is across variables for each respondent, you can create a variable for the calculation, How to Perform Mathematical Calculations on Variables, then use that to create Create a Complicated Filter) | Use R Code to Create a Filter or Use JavaScript Code to Create a Filter |
| Binary-Multi (Compact) or Nominal-Multi | A filter for each category/response (this will be a NET of the response across the variables in the set) | Change Structure > Nominal - Multi and while the variable is selected, in the Data Sources tree, click + > Convert To > Binary -Multi > Values Greater Than 0 |