R/sum2.R

Defines functions sum2

sum2 <- function(x,...){
    by2 <- list(...)
    if (length(by2)==0){
        sum(x)
    }else{
        for (i in 1:length(by2)) {
            if (i==1) group_res=c()
            group_res=paste0(group_res,by2[[i]])
        }
        table(rep(group_res,x))
    }
}

Try the fastStat package in your browser

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

fastStat documentation built on Jan. 13, 2021, 7:32 a.m.