There are different ways of removing categories from tables, and each has a different consequence as some (such as right click Hide and Delete) will change how the underlying variable set is analyzed in all outputs, rather than just the table being modified. This article describes how to hide and remove categories from tables using different methods.
- Method - Removing categories and setting values as missing
- Method - Re-basing multiple response (Binary - Multi) variable sets
- Method - Hiding categories
- Method - Use a rule
Requirements
A Displayr document with tables created from Nominal: Mutually exclusive categories, Nominal - Multi: Grid with unordered categories, or Binary - Multi: Non-mutually exclusive categories variable sets.
Method - Removing categories and setting values as missing
Right-clicking on a category of a Nominal or Nominal - Multi table and selecting Delete simultaneously hides the category and recomputes the percentages in the table (i.e., if it is categorical data, the percentages are rebased).
You can undo these changes by pressing undo in the toolbar or by right-clicking any row on the table and selecting Reset > Table Categories.
When categories are mutually exclusive (i.e., from a Nominal or Nominal - Multi variable set), you can also select the variable set from the Data Sources tree and click on the Values button in the object inspector to open the Value Attributes dialogue box. Here, you can change the selections in the Missing Data column to Exclude from analyses to delete a category from the table. This is identical to using the Delete option described above.
Method - Re-basing multiple response (Binary - Multi) variable sets
When using Delete on a table created from a Binary - Multi variable set, you will sometimes see the NET drop below 100%. This is because some respondents will not have selected any of the responses in the question. One solution to this is to create a filter based on the NET and apply it to the table. This will ensure that the NET will be 100%. You can do this by:
- Expand the variable set in the Data Sources tree by clicking the small triangle to the left of the variable's name.
- Select all of the variables within the variable set except for the variable(s) that you are deleting.
- Go to Calculation
> Any of > Any of.
- This will create a new variable based on the NET. With the new variable selected, go to the Data tab in the object inspector
and check Usable as a filter.
- You can then apply this filter to the existing table, which will then be based on the NET.
Method - Hiding categories
You can also right-click on a category in a table and select Hide to prevent it from being shown in the table. When you hide a category in this way, no change is made to the other values on the table. You can undo hiding by pressing undo , or right-clicking any row and selecting Reset > Table Categories (which returns the variable set to its original state). Note that using this method will change how the variable set is shown and analyzed in all other outputs.
Method - Use a rule
You can use a rule to hide empty rows and/or columns. To apply the rule, select the table, and from the object inspector , go to Data > Rules > + > Rows/Columns > Hide Empty Rows, Hide Empty Columns, or Hide Empty Rows and Columns. You can also write a custom rule using code similar to:
table.deleteColumn(table.numberColumns-1); // Delete last column
See How to Modify Table Rows and Columns using a Rule for more examples.
Next
How to Hide Rows and Columns with Small Sample Sizes in Tables and Visualizations
How to Hide Empty Rows and Columns in a Table or Visualization