Learn R Programming

Tmisc (version 1.0.1)

lowestnonzero: Lowest nonzero values

Description

Sometimes want to plot p-values (e.g., volcano plot or MA-plot), but if a statistical test returns a zero p-value, this causes problems with visualization on the log scale. This function returns a vector where the zero values are equal to the smallest nonzero value in the vector.

Usage

lowestnonzero(x)

Value

A vector of p-values where zero values are exchanged for the lowest non-zero p-value in the original vector.

Arguments

x

A vector of p-values between 0 and 1.

Examples

Run this code
lowestnonzero(c(.042, .02, 0, .001, 0, .89))

Run the code above in your browser using DataLab