#' Title
#'
#' @param x numeric number
#'
#' @return log transformation of x
#' @export
#'
#' @examples
#' x <- 4
#' log_2(x)
#'
#' x <- -1 # show error message
#' try(log_2(x))
log_2 = function(x){
if(x > 0){
log(x)
}else{
rlang::abort(message = "negative input, NA introduced!",
.subclass ="get_val_error",
invalid_input = x)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.