R/moment.R

Defines functions moment

Documented in moment

moment <- function(x, order = 1, center = FALSE, absolute = FALSE,
		   na.rm = FALSE) {
  if (na.rm) 
    x <- x[!is.na(x)]
  if (center)
    x <- x - mean(x)
  if (absolute)
    x <- abs(x)
  sum(x ^ order) / length(x)
}

Try the e1071 package in your browser

Any scripts or data that you put into this service are public.

e1071 documentation built on Feb. 16, 2023, 8:31 p.m.