format_tests: Formats hypothesis test results

View source: R/format_tests.R

format_testsR Documentation

Formats hypothesis test results


The results of function two_sample_htest and multi_sample_htest must be formated before printing. format_tests does this.


format_tests(x, ...)

## S3 method for class 'htest'
format_tests(x, format_tests.htest = NULL, ...)

## S3 method for class 'htest_with_effect_size'
format_tests(x, format_tests.htest_with_effect_size = NULL, ...)

## Default S3 method:
format_tests(x, ...)



An object.


Passed from and to other methods.


Either NULL or a function. Default is NULL. If a function, then it will replace format_tests.htest. The function must mimic format_tests: arguments are x and the ellipsis ... . Result is a data.frame with 1 rows and unique colnames.


Analog to argument format_tests.htest


This function defines which test results 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_tests checks if the output of format_tests is suitable for further processing.


A non-empty data.frame with one row. See also function check_format_tests.

Methods (by class)

  • format_tests(htest): Defines how to format class htest. Returns a data.frame with 1 rows. Column p contains the p-value of the x.

  • format_tests(htest_with_effect_size): Defines how to format class htest_with_effect_size. Returns a data.frame with 1 rows. Column p contains the p-value of the x. Column stat contains the teststatistic. Column Effect Size (CI) contains a effect size and its 95% Confidence interval.

  • format_tests(default): Tries to cast to data.frame with one row. Uses the names of the list as colnames.

atable documentation built on March 31, 2023, 9:23 p.m.