R/m.inf.1a.R

Defines functions m.inf.1a

m.inf.1a <- function(x,
                     which,
                     dispersion=c('mm', 's', 'se'))
{
  switch(match.arg(dispersion),
         mm = {
           m.inf <- aggregate(x$model[,1],
                              by=list(x$model[[which]]),
                              function(x) c(mean=mean(x),
                                            min=min(x),
                                            max=max(x)))[,2]
         }, s = {
           m.inf <- aggregate(x$model[,1],
                              by=list(x$model[[which]]),
                              function(x) c(mean=mean(x),
                                            'm - s'=mean(x) - sd(x),
                                            'm + s'=mean(x) + sd(x)))[,2]
         }, se= {
           m.inf <- aggregate(x$model[,1],
                              by=list(x$model[[which]]),
                              function(x) c(mean=mean(x),
                                            'm - se'=mean(x) - (sd(x) / sqrt(length(x))),
                                            'm + se'=mean(x) + (sd(x) / sqrt(length(x)))))[,2]
         })
}

Try the ScottKnottESD package in your browser

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

ScottKnottESD documentation built on May 2, 2019, 4:01 a.m.