inTextSummaryTable-stats {inTextSummaryTable} | R Documentation |
Statistics in the in-text table package.
Description
In the in-text package, different set of statistics are available.
Details
The statistics are first computed as numeric ('Base statistics' section below), then formatted to be displayed in the table ('Formatted statistics' section below).
Value
No return value, used for the documentation of
the stats
parameter
Base statistics
In the in-text package, the following 'base statistics' are reported in the summary table:
for a continuous variable:
'statMean': variable mean
'statSD': variable standard deviation
'statSE': variable standard error
'statMedian': variable median
'statMin': variable minimum
'statMax': variable maximum
During the computation of the statistics, if multiple and different values are available for a specific variable and subject ID (by row/column): an error is triggered.
for a categorical and continuous variable (or the full table):
'statN': number of subjects
'statm': number of records
'statPercN' (or 'statPercm'): percentage of subjects (or records) for the specific group
'statPercTotalN' (or 'statPercTotalm'): number of subjects (or records) considered for the total (denominator) of the percentage
The percentage and denominator of the percentage are based on the number of subjects or records depending on the
statsPerc
parameter.
These statistics are reported as numeric and non rounded in the summary table, and are typically used as input for the formatted statistics, or for plots.
Formatted statistics
In the in-text package, the following formatted statistics can be reported in the final output table.
for a continuous variable:
base statistics:
'Mean': formatted mean
'Median': formatted median
'SE': formatted standard error
'SD': formatted standard deviation
'Min': formatted minimum
'Max': formatted maximum
multiple:
'summary-default': default set of statistics for a continuous variable: 'n', 'Mean', 'SD', 'SE', 'Median', 'Min', 'Max'
'summary': all statistics available for a continuous variable: 'n', 'Mean', 'SD', 'SE', 'Median', 'Min', 'Max', '%', 'm'
combined statistics:
'median (range)': median (minimum,maximum)
'median\n(range)': median and (minimum, maximum) below (linebreak)
'mean (sd)': mean and standard deviation
'mean (se)': mean and standard error
'mean (range)': mean and (minimum, maximum)
'(min, max)': (minimum, maximum)
for a categorical or continuous variable (or the full table):
base statistics:
'n': formatted number of subjects
'm': formatted number of records
'%': formatted percentage of subjects
'%m': formatted percentage of records.
Note: this is only available if the percentage of records is reported (statsPerc
set to 'statm').
multiple:
'count-default': default set of statistics for a categorical variable: 'n', '%'
'count': all statistics available for a categorical variable: 'n', '%', 'm'
combined statistics:
'n (%)': number of subjects (and associated percentage)
'n/N (%)': number of subjects/total number of subjects (percentage)
'm (%)': number of records (and associated percentage).
Note: this is only available if the percentage of records is reported (statsPerc
set to 'statm').
#' These statistics are specified via the
stats
parameter (ortype
parameter ofgetStats
).
These statistics are reported as text variables in the summary table (as data.frame), and typically displayed inside the final table.
Statistics formatting
In general, all rounding is handled with
roundHalfUpTextFormat
.statistics for continuous variable:
if the number of decimals (
nDecCont
) is specified:
statistics are rounded with the following number of decimals, based on:'Min', 'Max':
nDecCont
'Mean', 'SD', 'Median':
nDecCont
+ 1'SE':
nDecCont
+ 2
Note that the number of decimals is extracted from standard rules/data is the variable of interest is specified (e.g. via
var
ingetStatsData
).if the number of decimals is not specified:
a default format is set via theformatC
function.
statistics for counts:
number of subjects, records are rounded with the number of decimals specified via
nDecN
ornDecm
(0 by default)percentages are formatted by default with
formatPercentage
.'n (%)' and 'm (%)':
if the percentage of subjects/records is missing, '-' is reported
if the number of subjects/records is 0, '0' is reported instead of '0 (0%)'
otherwise the number and percentage of subjects/records are formatted as specified
'n/N (%)':
if the percentage of subjects is missing, '-' is reported
if the number of subjects is 0, '0' is reported instead of '0/... (0%)'
otherwise the number and percentage of subjects and total are formatted as specified