Using Displayr
| 31 January 2017 | by Tim Bock
5 Ways to Create a Filter in Displayr

Five 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 Home > Data Selection > New Filter (see below) and choose the variable or pair of variables that you wish to create a filter. If you are already on the Insert tab, you can save a mouse click by going straight to Insert > Variables > 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. First select the variable in Data (bottom-left of the screen), and then 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 > More > Utilities (far-right of the Insert tab in the ribbon).
  • Filtering > Create Filters from Selected Variables.

A particularly useful aspect of the way that this works is that if you have merged together any of the categories in a variable set (see Introduction to Displayr 3: Creating tables, charts, and other visualizations), the new variables will be based on these merged categories. Also, if you wish you can modify these filters by changing their underlying JavaScript code, which we’ll look at next.



4. Creating new R and JavaScript variables

New variables can be created using R and JavaScript (Insert > Variables). If these variables are tagged as filters (see method 2 above), they can be used as filters, with any values greater than 0 being included in the filter (i.e., when such variables are applied as filters, only the data for cases with values of more than 0 on the filter variable will be used).



5. Question Type

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 Use as a filter for the variables.

Author: Tim Bock

Tim Bock is the founder of Displayr. Tim is a data scientist, who has consulted, published academic papers, and won awards, for problems/techniques as diverse as neural networks, mixture models, data fusion, market segmentation, IPO pricing, small sample research, and data visualization. He has conducted data science projects for numerous companies, including Pfizer, Coca Cola, ACNielsen, KFC, Weight Watchers, Unilever, and Nestle. He is also the founder of Q, a data science product designed for survey research, which is used by all the world’s seven largest market research consultancies. He studied econometrics, maths, and marketing, and has a University Medal and PhD from the University of New South Wales (Australia’s leading research university), where he was an adjunct member of staff for 15 years.

Follow by Email
follow us in feedly
Recent Posts

Keep updated with the latest in data science.