5 Ways to Create a Filter in Displayr
This blog shows how to create a filter. Before reading this blog, make sure you check out Using Displayr to filter data, analyses, and whole reports, which describes what filters can do in Displayr.
1. Creating simple filters from the ribbon
The simplest way to create a filter is to select Insert > Variables > Filter > New Filter (see below) and choose the variable or pair of variables that you wish to create a filter.
When you create a filter by pressing the buttons in the ribbon, you are both creating a filter and applying the filter to any currently selected outputs or pages. All the other methods described in this post create, but do not apply, filters.
2. Tagging a variable as a Filter
Any non-text variable set in Displayr can be set as a filter.
- Select the variable in Data (bottom-left of the screen), and
- Choose Usable as a filter from Properties (right-middle of the screen).
Cases that have a value of more than 0 are included in the filter.
3. Quickly creating lots of filters
To create lots of filters:
- Select the variable sets you wish to use to create the filters from Data (bottom-left of the screen).
- Insert > Variables > Filter > Filters from Selected Data.
A great example of how to create an R filter based off of the value in a drop down control box is on our blog here. For further examples of R-based filters, see How to Use Basic R Code for Creating Filters.
5. Variable Set Structure
This is a more exotic approach than the others, but can be a huge time saver. When the structure of a variable set is changed to either Binary - Multi or Binary - Grid the values of the variables are automatically recoded to be 0s and 1s, and you choose which values are converted to 1s and which to 0s. Then, select Usable as a filter for the variables.