R/sum_squares.R

Defines functions sum_squares

Documented in sum_squares

#' Calculate the sums of squares for a sample
#'
#' returns the sum of the squared deviations
#' from mean, SS(x) of a numeric vector
#'
#' @param v numeric vector
#'
#' @return number
#' @export
#'
#' @examples
#' sum_squares(rnorm(50))
#'
sum_squares <- function(v){
  sum((v - mean(v))^2) # Calculate sum of squares
}
CatherineMcCarthy/mypackage documentation built on Jan. 8, 2020, 12:01 a.m.