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