formatPval {JWileymisc}R Documentation

Function to simplify formatting p-values for easy viewing / publication

Description

Function to simplify formatting p-values for easy viewing / publication

Usage

formatPval(
  x,
  d = 3,
  sd,
  includeP = FALSE,
  includeSign = FALSE,
  dropLeadingZero = TRUE
)

Arguments

x

p values to convert

d

number of digits

sd

number of scientific digits. Defaults to d if missing.

includeP

logical value whether to include the character “p” itself. Defaults to FALSE.

includeSign

logical value whether to include the character “=” or “<”. Defaults to FALSE and if includeP = TRUE it must be TRUE.

dropLeadingZero

logical value whether to drop leading zeros for p-values. Defaults to TRUE.

Value

A character string with stars

Examples

formatPval(c(.00052456, .000000124, .01035, .030489, .534946))
formatPval(c(.00052456, .000000124, .01035, .030489, .534946), 3, 3, FALSE, TRUE)
formatPval(c(.00052456, .000000124, .01035, .030489, .534946), 3, 3, TRUE, TRUE)
formatPval(c(.00052456, .000000124, .01035, .030489, .534946), 5)
formatPval(c(1, .15346, .085463, .05673, .04837, .015353462,
  .0089, .00164, .0006589, .0000000053326), 3, 5)
formatPval(c(1, .15346, .085463, .05673, .04837, .015353462,
  .0089, .00164, .0006589, .0000000053326), 3, 5, dropLeadingZero = FALSE)

[Package JWileymisc version 1.4.1 Index]