R/tam_aggregate.R

Defines functions tam_aggregate

Documented in tam_aggregate

## File Name: tam_aggregate.R
## File Version: 0.04

tam_aggregate <- function(x, group, mean=FALSE, na.rm=TRUE)
{
    g1 <- rowsum(x=x, group=group, na.rm=na.rm)
    if (mean){
        g2 <- rowsum(x=1+0*x, group=group, na.rm=na.rm)
        g1 <- g1 / g2
    }
    ng1 <- as.numeric(paste(rownames(g1)))
    g1 <- cbind( ng1, g1 )
    return(g1)
}

Try the TAM package in your browser

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

TAM documentation built on Aug. 29, 2022, 1:05 a.m.