zero_plus: Make all values strictly higher than zero

View source: R/assoc.R

zero_plusR Documentation

Make all values strictly higher than zero

Description

This is an auxiliary function that makes all values in numeric vector x strictly positive by replacing all values equal to or lower than zero with the values in small.pos. small_pos stands for 'small positive constant'.

Usage

zero_plus(x, small_pos = 1e-05)

Arguments

x

A numeric vector.

small_pos

A (small) positive number to replace negative values and 0s.

Value

A copy of x in which all values equal to or lower than zero are replaced by small_pos.

Examples

(x <- rnorm(30))
zero_plus(x)

mclm documentation built on Oct. 3, 2022, 9:07 a.m.