R/getvariances.R

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 May 2, 2019, 6:47 a.m.