#' Soft-thresholding function
#'
#' @param a - scalar
#' @param lambda - positive value for thresholding
#'
#' @return - outputs S(a, lambda) = sign(a)max(|a| - lambda, 0)
#' @export
#'
#' @examples
#' soft(3, 1)
soft <- function(a, lambda){
sign(a) * max(abs(a) - lambda, 0)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.