This article describes how to hide rows or columns in a table based on their Sample Size. You can go from a table showing all the data:

To a table that only shows data for rows/columns with sufficient data (I'm using a Sample Size threshold of 20 for the table below):

## Requirements

- A table showing at least two statistics in the
**STATISTICS > Cells**dropdown, one of which being either*Row Sample Size*or*Column Sample Size* - General knowledge of How to Work with Data in R and How to Work with Conditional R Formulas.

## Method - Hide rows

In this example, we'll hide all rows with a Row Sample Size of less than 20 - in the first column. If you have different bases for the different columns, you can specify a different column to use.

- Click
**Calculation**and click on the page to create a new empty R**Calculation**. - Paste the code below into your
**R CODE**box. Change*table.Preferred.cola.by.Quarterly.dates.6*to the name of your table, and edit the threshold of*20*and final statistic to show (currently*Column %*) as needed.#identify table

x=table.Preferred.cola.by.Quarterly.dates.6

#identify rows with sample sizes above 20 in the first column

#change 20 if needed

keeprows=x[,1,"Row Sample Size"] > 20

#return table without those rows

#return the Column % or change that to the other stat in your table

x[keeprows,,"Column %"] - Click
**Calculate**. - OPTIONAL: Add % signs and reduce the number of decimals shown from the
**Properties > APPEARANCE**options in the**object inspector.**

## Method - Hide Columns

Similar to above, if you'd like to remove columns based on *Column Sample Size* of 20 you can use the code below:

#identify table

x=table.Preferred.cola.by.Quarterly.dates.6

#identify cols with sample sizes above 20 in the first row

#change 20 if needed

keepcols=x[1,,"Column Sample Size"] > 20

#return table without those cols

#return the Column % or change that to the other stat in your table

x[,keepcols,"Column %"]

## Next

How to Hide Rows or Columns With Small Sample Sizes

How to Blank or Cap R Table Cells Based on a Different Statistic Using R

How to Hide an Output with a Small Sample Size Using an R Error

How to Hide an Output with a Small Sample Size Using a Calculation

## Comments

0 comments

Please sign in to leave a comment.