p2asterisk: Convert p values into asterisks

View source: R/p2asterisk.R

p2asteriskR Documentation

Convert p values into asterisks

Description

The function map p values into asterisks by common definitions

Usage

p2asterisk(p, use0.1 = TRUE)

Arguments

p

Numerical, p values (between 0 and 1), can be a matrix or more generally an array

use0.1

Logical, whether a dot should be displayed if 0.05<p<0.1

Value

A character vector of the same length as p of asterisk symbols. In case p is an array, both 'dim' and 'dimnames' properties are copied to the returning value.

Note

NA will be mapped to empty strings.

Examples


myPvals <- c(0.0005, 0.02, 0.4, 0.075, NA, 0.0044)
myPasterisks <- p2asterisk(myPvals, use0.1=FALSE)
stopifnot(identical(myPasterisks, c("***", "*", "", "", "", "**")))

myPasterisks2 <- p2asterisk(myPvals, use0.1=TRUE)
stopifnot(identical(myPasterisks2, c("***", "*", "", ".", "",  "**")))


bedapub/ribiosPlot documentation built on Sept. 1, 2023, 6:50 p.m.