Learn R Programming

mclm (version 0.2.7)

zero_plus: 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)

Value

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

Arguments

x

A numeric vector.

small_pos

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

Examples

Run this code
(x <- rnorm(30))
zero_plus(x)

Run the code above in your browser using DataLab