Learn R Programming

ribiosPlot (version 1.3.0)

p2asterisk: Convert p values into asterisks

Description

The function map p values into asterisks by common definitions

Usage

p2asterisk(p, use0.1 = TRUE)

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.

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

Examples

Run this code

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("***", "*", "", ".", "",  "**")))

Run the code above in your browser using DataLab