Sometimes, you may want to modify what data is shown on a visualization to add/remove certain categories. The easiest way is to do this without code via a rule, and you can also access the Data > Row Manipulations and Column Manipulations sections in the object inspector for other options. There are lots of options for determining what data to show. It supports specific row/column names and positions, sample size thresholds, relative positions in the input table, other calculations listing what to show, and using a control to toggle what to show based on the user's selections. This article describes various methods of filtering in/out the rows/columns shown in Displayr's visualizations and tables with custom formatting, including:
Method 1 - Hide empty rows/columns
Method 2 - Hide rows/columns with small sample sizes
Method 3 - Display specific rows and columns
Method 4 - Hide specific rows and columns
Method 5 - Select which Rows and Columns to Show using Controls
Method 6 - Number of rows/columns from top/left to show
Method 7 - Number of rows/columns from bottom/right to show
Method 8 - Including NETs and Totals
Method 9 - If needed, select what rows/columns to show via an R Calculation
In this article, I have used the following table as an example:
Requirements
- A Displayr Visualization, excluding "with Test" Visualizations, or
- A specialty table created using Visualization > Specialty Table > Tables with Custom Formatting
- Method 2 only: Column Sample Size, Column n, Sample Size, or Base n statistic.
Method 1 - Hide empty rows/columns
This option hides rows and/or columns that don't contain any data.
- Select the visualization on your Page.
- From the object inspector, go to Data > Rules > + > Rows/Columns > Hide Empty Rows, Hide Empty Columns, or Hide Empty Rows and Columns.
Note: You must apply the rule directly to the input table if you see a table icon in the Data > Data Source > Data field in the object inspector of a visualization.
You will also see a warning in the Rules section of the object inspector if you have applied a rule directly to a non-compatible visualization, and you will need to apply it to the input table instead. For example:
Method 2 - Hide rows/columns with small sample sizes
This option removes rows and/or columns with a low sample size as defined in Step 4.
- Ensure that the input source of the visualization contains one of the following statistics: Column Sample Size, Column n, Sample Size, or Base n (see requirements).
- Select the visualization or table on your Page.
- From the object inspector, go to Data > Rules + > Rows/Columns > Hide Columns with Small Sample Sizes, Hide Rows and Columns with Small Sample Sizes, or Hide Rows with Small Sample Sizes.
- Specify the sample size cut-off in Minimum Sample Size.
- OPTIONAL: Set the Statistic for columns/rows if you have multiple statistics applied.
- OPTIONAL: If you are using the Hide Rows and Columns with Small Sample Sizes, you can untick Hide Columns or Hide Rows if you decide that you want to show one or the other.
- Click OK.
Note: You must apply the rule directly to the input table if you see a table icon in the Data > Data Source > Data field in the object inspector of a visualization.
You will also see a warning in the Rules section of the object inspector if you have applied a rule directly to a non-compatible visualization, and you will need to apply it to the input table instead. For example:
Method 3 - Display specific rows and columns
- Select the visualization or table on your Page.
- To display specific rows, go to the object inspector > Data > Row Manipulations > Select Rows to show by and select Typing row names or indices.
To display specific columns, go to the object inspector > Data > Column Manipulations > Select Columns to show by and select Typing row names or indices. - Input either row/column number you wish to show, separated by a comma (e.g., 1,2,3), or input the exact row/column labels you want to show, separated by a comma (e.g., Strongly disagree, Somewhat disagree).
Displayr will return a table showing rows 1, 2, and 3, and columns Strongly disagree and Somewhat disagree. All other rows and columns are hidden.
Method 4 - Hide specific rows and columns
By default, the NET, Total, and SUM rows/columns are hidden from the final output. To change the default settings:
- Select the visualization or table on your Page.
- To hide specific rows, go to the object inspector > Data > Row Manipulations > Rows to ignore.
To hide specific columns, go to the object inspector > Data > Column Manipulations > Columns to ignore.
- Specify the rows/columns you wish to ignore by adding them to the list, referencing the name of the row/column, again separating each item by a comma.
Method 5 - Select which Rows and Columns to Show using Controls
See: How to Select Which Rows or Columns to Show in a Visualization Based on a Control Box Selection
Method 6 - Number of rows/columns from top/left to show
- Select the visualization or table on your Page.
- To specify the number of rows to show from the top, go to the object inspector > Data > Row Manipulations > Number of rows from the top to show.
To specify the number of columns to show from the left, go to the object inspector > Data > Column Manipulations > Number of columns from the left to show. - Input the desired number of rows (e.g., 2) and columns to be shown (e.g., 3).
Displayr will return a table showing the first two rows and the first three columns from the left.
Method 7 - Number of rows/columns from bottom/right to show
- Select the visualization or table on your Page.
- To specify the number of rows to show from the bottom, go to the object inspector > Data > Row Manipulations > Number of rows from the bottom to show.
To specify the number of columns to show from the right, go to the object inspector > Data > Column Manipulations > Number of columns from the right to show. - Input the desired number of rows (e.g., 2) and columns to be shown (e.g., 3).
Displayr will return a table showing the last two rows and the three columns from the right.
Method 8 - Ignoring rows/columns
There is a list of rows/columns to remove from the plot in the object inspector > Data tab under Row Manipulations > Rows to ignore or Column Manipulations > Columns to ignore. By default, NETs, Total, and Sum rows/columns are ignored and not plotted in visualizations. To include the NET, you would simply remove it from the comma-delimited list. You can also add names of any other rows/columns you'd like to remove from the visualization as well (such as Don't Know, Other, Misc, etc), by adding the row/column name to the list separated by a comma.
Method 9 - Select what rows/columns to show via an R Calculation
See: How to Select and Order Rows or Columns to Show in a Visualization Based on a Calculation.
Next
How to Select Which Rows or Columns to Show in a Visualization Based on a Control Box Selection
How to Select and Order Rows or Columns to Show in a Visualization Based on a Calculation