R/Tapply.R

Defines functions Tapply

Documented in Tapply

Tapply <- function(formula, fun, data, na.action=na.pass, ..., targs=list()){
  yx <- if (missing(data)) model.frame(formula, na.action=na.action)
    else model.frame(formula, data=data, na.action=na.action)
  if (ncol(yx) < 2) stop("fewer than two variables")
  targs[c("X", "INDEX", "FUN")] <- list(yx[, 1], yx[, -1], fun)
  targs <- c(targs, list(...))
  do.call(tapply, targs)
}

Try the car package in your browser

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

car documentation built on March 31, 2023, 6:51 p.m.