View source: R/format_statistics.R
format_statistics | R Documentation |
The results of function statistics
must be formated before printing. format_statistics
does this.
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, ...)
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 |
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.
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
.
format_statistics(statistics_numeric)
: Defines how to format class statistics_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 class statistics_factor
.
Returns a data.frame.
Column 'tag'
contains all names of x
.
Column 'value'
contains the percentages and the total number of values in brackets.
format_statistics(statistics_count_me)
: Defines how to format class statistics_count_me
.
Returns a data.frame.
Column 'tag'
contains the empty character ''
.
The empty character is choosen because colname_for_observations
already appears in the final table.
Column 'value'
contains the number of observations.
See also 'colname_for_observations'
in atable_options
.
format_statistics(default)
: Returns a data.frame.
Column 'tag'
contains all names of x
.
Column 'value'
contains all elements of x
, rounded by format
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.