Skip to contents

A utility function to display statistical result in a plot in scientific notation (when appropriate)

Usage

display.statistical.result(
  x,
  lower.cutoff = 2.2e-50,
  scientific.cutoff = 0.001,
  digits = 2,
  statistic.type = 'P',
  symbol = ': '
  );

Arguments

x

Numeric value to be displayed

lower.cutoff

For values of x smaller than lower.cutoff, the return value will be "< lower.cutoff". Defaults to 2.2e-16

scientific.cutoff

For values of x larger or equal to scientific.cutoff, standard notation will be used (rather than scientific notation). Defaults to 0.001

digits

Number of decimal places of precision to be shown

statistic.type

Type of statistic to be displayed, defaults to “P”.

symbol

Symbol prior to statistic to be displayed, defaults to “: ”.

Value

Returns an expression

Author

Nathalie Moon

See also

scientific.notation

Examples

set.seed(100);

display.statistical.result(x = 0.00000000000000000000234);
#> expression(paste("P", ": ", c(base = "2.34") %*% 10^c(exponent = -21), 
#>     phantom("|")[phantom("|")]))
display.statistical.result(x = 0.023, statistic.type = 'Q');
#> expression("Q: 0.023")
display.statistical.result(x = 0.001, scientific.cutoff = 0.01, symbol = ' = ');
#> expression(paste("P", " = ", c(base = "1.00") %*% 10^c(exponent = -3), 
#>     phantom("|")[phantom("|")]))