Modify Whole Table or Plot - Hide Non-significant Rows and Columns

From Q
Jump to navigation Jump to search

This rule will hide any rows or columns in the table which do not have any significant results. The significance is evaluated by checking the Corrected p statistic against a set level that you can change by editing the rule. You can choose to hide rows, or columns, or both.

How to apply this rule

For the first time in a project

  • Select the table(s)/chart(s) that you wish to apply the rule to.
  • Start typing the name of the Rule into the Search features and data box in the top right of the Q window.
  • Click on the Rule when it appears in the QScripts and Rules section of the search results.


  • Select Automate > Browse Online Library.
  • Choose this rule from the list.

Additional applications of the rule

  • Select a table or chart that has the rule and any table(s)/chart(s) that you wish to apply the rule to.
  • Click on the Rules tab (bottom-left of the table/chart).
  • Select the rule that you wish to apply.
  • Click on the Apply drop-down and choose your desired option.
  • Check New items to have it automatically applied to new items that you create. Use Edit > Project Options > Save as Template to create a new project template that automatically uses this rule.

Removing the rule

  • Select the table(s)/chart(s) that you wish to remove the rule from.
  • Press the Rules tab (bottom-right corner).
  • Press Apply next to the rule you wish to remove and choose the appropriate option.

How to modify the rule

  • Click on the Rules tab (bottom-left of the table/chart).
  • Select the rule that you wish to modify.
  • Click Edit Rule and make the desired changes. Alternatively, you can use the JavaScript below to make your own rule (see Customizing Rules).


includeWeb("Table JavaScript Utility Functions");

form.setSummary("Hide non-significant rows and columns");
form.setHeading("Hide Non-Significant Rows and Columns");
let description = form.newLabel("Hide any rows or columns where the cells are not significant");
description.lineBreakAfter = true; 

let sig_label = form.newLabel("Hide if Corrected p values above:");
let sig_level = form.newNumericUpDown('pval');
sig_level.lineBreakAfter = true;

let rows_box = form.newCheckBox('rs', "Hide rows");
rows_box.lineBreakAfter = true;

let columns_box = form.newCheckBox('cs', "Hide columns");

form.setInputControls([description, sig_label, sig_level, rows_box, columns_box]);

if (table.availableStatistics.indexOf('Corrected p') > -1) {

    let vals = table.get("Corrected p");
    let thresh = sig_level.getValue();

    if (columns_box.getValue() && tableHasColumns()) {
        let columns_to_remove = identifyRowsOrColumnsToRemove(true, vals, allValuesGreaterThanOrNaN, {threshold: thresh});
        for (var col = table.numberColumns - 1; col >= 0; col--)
            if (columns_to_remove[col])

    if (rows_box.getValue()) {
        let rows_to_remove = identifyRowsOrColumnsToRemove(false, vals, allValuesGreaterThanOrNaN, {threshold: thresh});
        for (var row = table.numberRows - 1; row >= 0; row --)
            if (rows_to_remove[row])


See also