formatP: Re-format p-values, avoiding rounding to 0 and adding...

View source: R/basefunctions.R

formatPR Documentation

Re-format p-values, avoiding rounding to 0 and adding surprisal if requested

Description

formatP simplifies p-values by rounding to the maximum of p or a predefined level. Optionally < or = can be added, as well as symbols according to significance level.

Usage

formatP(
  pIn,
  ndigits = 3,
  textout = TRUE,
  pretext = FALSE,
  mark = FALSE,
  german_num = FALSE,
  add.surprisal = FALSE,
  sprecision = 1
)

Arguments

pIn

A numeric vector or matrix with p-values.

ndigits

Number of digits (default=3).

textout

Cast output to character (default=TRUE)?

pretext

Should = or < be added before p (default=FALSE)?

mark

Should significance level be added after p (default=FALSE)?

german_num

change dot (default) to comma?

add.surprisal

Add surprisal aka Shannon information to p-value (default=FALSE)?

sprecision

Rounding level for surprisal (default=1).

Value

vector or matrix (depending on type of pIn) with type character (default) or numeric, depending on parameter textout

Examples

formatP(0.012345)
formatP(0.012345, add.surprisal = TRUE)
formatP(0.012345, ndigits = 4)
formatP(0.000122345, ndigits = 3, pretext = TRUE)

wrappedtools documentation built on Oct. 10, 2024, 5:07 p.m.