format_statistics {atable} | R Documentation |
Format statistics
Description
The results of function statistics
must be formated before printing. format_statistics
does this.
Usage
format_statistics(x, ...)
## S3 method for class 'statistics_numeric'
format_statistics(x, format_statistics.statistics_numeric = NULL, ...)
## S3 method for class 'statistics_factor'
format_statistics(x, format_statistics.statistics_factor = NULL, ...)
## S3 method for class 'statistics_count_me'
format_statistics(x, ...)
## Default S3 method:
format_statistics(x, ...)
Arguments
x |
An object. |
... |
Passed from and to other methods. |
format_statistics.statistics_numeric |
Either |
format_statistics.statistics_factor |
Analog to argument format_statistics.statistics_numeric |
Details
This function defines which statistics are printed in the final table and how they are formated.
The format depends on the class x
. See section methods.
If you are not pleased with the current format you may alter these functions.
But you must keep the original output-format, see section Value.
Function check_format_statistics
checks if the output of statistics is suitable for further processing.
Value
A non-empty data.frame with 2 columns called 'tag'
and 'value'
.
Column 'tag'
has class factor and no duplicates.
Column 'value'
is a character.
See also function check_format_statistics
.
Methods (by class)
-
format_statistics(statistics_numeric)
: Defines how to format classstatistics_numeric
. Returns a data.frame with 2 rows. Column'tag'
contains'Mean_SD'
and'valid_missing'
. Column'value'
contains two values: first value is the rounded mean and standard deviation, pasted them together. The standard deviation is bracketed. Second value is the number of non-missing and missing values pasted together. The number of missing values is bracketed. -
format_statistics(statistics_factor)
: Defines how to format classstatistics_factor
. Returns a data.frame. Column'tag'
contains all names ofx
. Column'value'
contains the percentages and the total number of values in brackets. -
format_statistics(statistics_count_me)
: Defines how to format classstatistics_count_me
. Returns a data.frame. Column'tag'
contains the empty character''
. The empty character is choosen becausecolname_for_observations
already appears in the final table. Column'value'
contains the number of observations. See also'colname_for_observations'
inatable_options
. -
format_statistics(default)
: Returns a data.frame. Column'tag'
contains all names ofx
. Column'value'
contains all elements ofx
, rounded byformat
.