atable (version 0.1.0)

statistics: Calculates descriptive statistics

Description

Calculates descriptive statistics depending on the class of its input.

Usage

statistics(x, ...)

# S3 method for numeric statistics(x, ...)

# S3 method for factor statistics(x, ...)

# S3 method for logical statistics(x, labels_TRUE_FALSE = atable_options("labels_TRUE_FALSE"), ...)

# S3 method for character statistics(x, ...)

# S3 method for count_me statistics(x, ...)

Arguments

x

An object.

...

Passed from and to other methods.

labels_TRUE_FALSE

For relabeling logicals. See also atable_options.

Value

A named list with length > 0. The names of the list have no duplicates. Function check_statistics checks if the output of statistics is suitable for further processing.

The results of statistics are passed to function format_statistics. So the results of statistics must have a class for which the generic format_statistics has a method.

Methods (by class)

  • numeric: Descriptive statistics are: length, number of missing values, mean and standard deviation. Class of the result is 'statistics_numeric' and there is a method format_statistics_to_Latex.statistics_numeric. This function is meant for interval scaled variables.

  • factor: Counts the numbers of occurrences of the levels of x with function table. This function is meant for nominal and ordinal scaled variables.

  • logical: Casts x to factor, then applies statistics again. The labels for TRUE and FALSE can also be modfied by setting atable_options('labels_TRUE_FALSE').

  • character: Casts x to factor, then applies statistics again.

  • count_me: Returns the length of x. For class 'count_me' see add_observation_column.

Details

Calculates descriptive statistics depending on the class of its input.

Results are passed to function format_statistics.

If you are not pleased with the current descriptive statistics you may alter these functions. But you must keep the original output-format, see section Value. Function check_statistics checks if the output of statistics is suitable for further processing.