R/standard_error.R

Defines functions standard_error

Documented in standard_error

#' @title Standard error of the mean of a numeric vector
#' @description Computes the standard error of the mean of a numeric vector as `round(sqrt(var(x)/length(x)), 3)`
#' @param x A numeric vector.
#' @return A numeric value.
#' @details The function removes `NA` values before computing the standard error, and rounds the result to 3 decimal places.
#' @examples
#' if(interactive()){
#'
#'  standard_error(runif(10))
#'
#' }
#' @rdname standard_error
#' @export
standard_error <- function(x){
  x <- na.omit(x)
  x <- round(sqrt(var(x)/length(x)), 3)
  x
}
BlasBenito/spatialRF documentation built on Sept. 1, 2022, 1:42 p.m.