Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

round_ps

Helper functions for rounding p-values


Description

These functions return a character vector of p-values that are rounded as described below and without the leading zero before the decimal point.

Usage

round_ps(x)

round_ps_apa(x)

Arguments

x

a numeric vector

Details

For round_ps p-values are rounded in a sane way: .99 - .01 to two digits, < .01 to three digits, < .001 to four digits.

For round_ps_apa p-values are rounded following APA guidelines: .999 - .001 to three digits, and < .001 for values below this threshold.

Value

A character vector with the same length as x.

Note

These functions are useful in nice and the default is set via afex_options.

Author(s)

Henrik Singmann

Examples

x <- runif(10)
y <- runif(10, 0, .01)

round_ps(x)
round_ps_apa(x)

round_ps(y)
round_ps_apa(y)

round_ps(0.0000000099)
round_ps_apa(0.0000000099)

afex

Analysis of Factorial Experiments

v0.28-1
GPL (>= 2)
Authors
Henrik Singmann [aut, cre] (<https://orcid.org/0000-0002-4842-3657>), Ben Bolker [aut], Jake Westfall [aut], Frederik Aust [aut] (<https://orcid.org/0000-0003-4900-788X>), Mattan S. Ben-Shachar [aut], Søren Højsgaard [ctb], John Fox [ctb], Michael A. Lawrence [ctb], Ulf Mertens [ctb], Jonathon Love [ctb], Russell Lenth [ctb], Rune Haubo Bojesen Christensen [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.