R/adj_groupmean.R

Defines functions adj_groupmean

## File Name: adj_groupmean.R
## File Version: 0.01


adj_groupmean <- function( variable, cluster )
{
    a1 <- stats::aggregate( variable, list(cluster), mean  )
    a2 <- stats::aggregate( 1+0*variable, list(cluster), sum  )
    ind <- match( cluster, a1[,1] )
    ( a2[ind,2] * a1[ ind, 2] - variable ) / a2[ ind, 2]
}

Try the miceadds package in your browser

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

miceadds documentation built on March 13, 2026, 5:06 p.m.