Introduction
This article describes how to go from a table...
...to an output that displays a custom message when the sample size is too small.
Requirements
A table with a sample size statistic showing, such as Column Sample Size or Sample Size.
Method
1. Select your table.
2. Go to Properties > GENERAL > Name and copy the object name.
3. Select Calculation > Custom Code.
4. In the object inspector, go to Properties > R CODE.
5. Reference the name of the table from step 2 and the cell (row 1, column 2) where the sample size figure is: n = sample.table[1, 2]
.
6. Set the minimum sample threshold: min.sample = 40
.
7. Paste in the rest of the code to display a transparent box with a specific message when the sample is below this threshold:
html = if (n >= min.sample) '' else '<!DOCTYPE html>
<html>
<head>
<style>
body { background-color: white; }
</style>
</head>
<body>
Sample size is too small to show results
</body>
</html>'
rhtmlMetro::Box(html, text.as.html = TRUE)
8. Resize the output to cover whatever you wish to disappear.
See Also
How to Handle Outputs with Small or No Data using R
How to Work with Conditional R Formulas
How to Hide an Output with a Small Sample Size Using an R Error
How to Blank or Cap R Table Cells Based on a Different Statistic Using R
How to Hide Rows or Columns Based on Sample Size Using R
Comments
0 comments
Article is closed for comments.