#' Detect outliers based on sd
#'
#' This function computes z scores and displays any values 3 sds above or below the mean
#' @keywords outliers
#' @param x a list object
#' @param y a number
#' @export
#' @import dplyr
#' @examples
#' z.outlier()
z.outlier = function(x, y) {
p = scale(x, center = TRUE)
z.score = p[ p >= y | p <= -y]
value = x[ p >=y | p <= -y]
a = data.frame(z.score, value)
#return(a) #uncomment this to get back to default
if (empty(a) == FALSE){ #
return(a) } #
if (empty(a) == TRUE)
{cat(paste("No Outliers Detected", "\n"))} #
}
#document()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.