\name{MeanListDim}
\alias{MeanListDim}
\title{
  Averages A Matrix Along Various Dimensions
}
\description{
  Averages the matrix var along a set of dimensions given by the argument dims.
}
\usage{
  MeanListDim(var, dims, narm = TRUE)
}
\arguments{
  \item{var}{
    Matrix to average.
  }
  \item{dims}{
    List of dimensions to average along.
  }
  \item{narm}{
    Ignore NA (TRUE) values or not (FALSE).
  }
}
\value{
  Matrix with as many dimensions less than the input matrix as provided by 
  the list dims and containing the average along this list of dimensions.
}
\examples{
  startDates <- c('19901101', '19951101', '20001101')
  sampleData <- Load('tos', c('i00k'), c('ERSST'),  startDates,
                     nleadtime = 124, leadtimemin = 1, leadtimemax = 60, 
                     sampleperiod = 3, output = 'lonlat', latmin = -60,
                     latmax = 65, lonmin = 315, lonmax = 360)
  dims_to_mean <- c(2, 5, 6)  # Mean along members, latitudes and longitudes
  print(dim(MeanListDim(sampleData$mod, dims_to_mean)))
}
\author{
  History:
  0.1  -  2011-04  (V. Guemas, \email{vguemas@ic3.cat})  -  Original code
  1.0  -  2013-09  (N. Manubens, \email{nicolau.manubens@ic3.cat})  -  Formatting to R CRAN
}
\keyword{datagen}
