Modify Whole Table or Plot - Hide Non-significant Rows and Columns
Jump to navigation
Jump to search
Q Technical Reference
Q Technical Reference
Q Technical Reference > Creating And Modifying Tables
Q Technical Reference > Setting Up Data > Creating New Variables
Q Technical Reference > Updating and Automation > Automation Online Library
Q Technical Reference > Updating and Automation > JavaScript > Table JavaScript and Plot JavaScript
Rule Online Library
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.
OR
- 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).
JavaScript
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;
form.setInputControls([description]);
let sig_label = form.newLabel("Hide if Corrected p values above:");
let sig_level = form.newNumericUpDown('pval');
sig_level.setDefault(0.05);
sig_level.setIncrement(0.001);
sig_level.lineBreakAfter = true;
let rows_box = form.newCheckBox('rs', "Hide rows");
rows_box.setDefault(true);
rows_box.lineBreakAfter = true;
let columns_box = form.newCheckBox('cs', "Hide columns");
columns_box.setDefault(true);
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])
deleteColumnComplete(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])
deleteRowComplete(row);
}
}
See also
- User Input for Rules for technical information on Rules.
- Rule Online Library for other examples of Rules.
- Table JavaScript and Plot JavaScript for the JavaScript that is used to write custom rules.
- JavaScript for information about the JavaScript programming language.
Q Technical Reference
Q Technical Reference
Q Technical Reference > Creating And Modifying Tables
Q Technical Reference > Setting Up Data > Creating New Variables
Q Technical Reference > Updating and Automation > Automation Online Library
Q Technical Reference > Updating and Automation > JavaScript > Table JavaScript and Plot JavaScript
Rule Online Library