R/modp.R

Defines functions modp

Documented in modp

#' modp
#'
#' A function which rrturns either the input value (if positive) or zero (if
#' negative)
#'
#' @param x a numberic vector
#' @return a numeric vector with negative values replaced with 0
#' @details A fucntion which returns a version of x with negative values replacd with 0
modp <- function(x){
  x*(sign(x)+1)/2
}

Try the psc package in your browser

Any scripts or data that you put into this service are public.

psc documentation built on June 8, 2025, 10:16 a.m.