R/getvariances.R

Defines functions getvariances

Documented in getvariances

getvariances <-
function(data, factors)
{
    dimension <- dim(data)[2]
    vars <- do.call(rbind, lapply(split(as.data.frame(data), as.data.frame(factors)), var))
    variances <- array(t(vars), c(dimension, dimension, length(levels(as.factor(factors)))))
    return(variances)
}

Try the dawai package in your browser

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

dawai documentation built on Jan. 20, 2018, 9:22 a.m.