Modify Footers - Add Footnote to Cells with Small Sample Sizes
Jump to navigation
Jump to search
This rule adds an asterisk in each cell and adds a footnote whenever a Column n is less than a user-specified amount (default is 30). If the table does not contain Column n then Base n is used instead.
Example
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
var __webpack_modules__ = ({});
// The module cache
var __webpack_module_cache__ = {};
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = (__webpack_module_cache__[moduleId] = {
exports: {}
});
// Execute the module function
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
// Return the exports of the module
return module.exports;
}
// webpack/runtime/rspack_version
(() => {
__webpack_require__.rv = () => ("1.7.2")
})();
// webpack/runtime/rspack_unique_id
(() => {
__webpack_require__.ruid = "bundler=rspack@1.7.2";
})();
includeWeb('Table JavaScript Utility Functions');
excludeRTables();
// Create form
form.setHeading('Add Footnote to Cells with Small Sample Sizes');
var stat_name = table.getTranslation('Column n');
var labelControl = form.newLabel('Minimum ' + stat_name + ':');
var minimumNControl = form.newNumericUpDown('minimumN');
minimumNControl.setMaximum(999999999);
minimumNControl.setDefault(20);
let description = form.newLabel('Adds an asterisk to all cells in a column and adds a footnote whenever a ' +
stat_name + ' is less than a user-specified amount.');
description.lineBreakAfter = true;
form.setInputControls([description, labelControl, minimumNControl]);
// Validate input.
var minimumN = minimumNControl.requireValue(); // highlights input box if not entered
form.setSummary('Add footnote where sample size < ' + minimumN); // text appears with format in manager
// Apply rule
if (table.availableStatistics.indexOf('Column n') !== -1)
table.addFootNoteForCellsLessThan('Column n', minimumN, '*', '* sample size < ' + minimumN);
else if (table.availableStatistics.indexOf('Base n') !== -1)
table.addFootNoteForCellsLessThan('Base n', minimumN, '*', '* sample size < ' + minimumN);
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.
