\HeaderA{ma3x3}{Two dimensional Moving Averages with 3x3 Window}{ma3x3}
\methaliasA{ma3x3.matrix}{ma3x3}{ma3x3.matrix}
\methaliasA{ma3x3.spottedarray}{ma3x3}{ma3x3.spottedarray}
\keyword{smooth}{ma3x3}
\begin{Description}\relax
Apply a specified function to each to each value of a matrix and its immediate neighbors.
\end{Description}
\begin{Usage}
\begin{verbatim}
ma3x3.matrix(x,FUN=mean,na.rm=TRUE,...)
ma3x3.spottedarray(x,printer,FUN=mean,na.rm=TRUE,...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] numeric matrix
\item[\code{FUN}] function to apply to each window of values
\item[\code{na.rm}] logical value, should missing values be removed when applying \code{FUN}
\item[\code{...}] other arguments are passed to \code{FUN}
\item[\code{printer}] list giving the printer layout, see \code{\LinkA{PrintLayout-class}{PrintLayout.Rdash.class}}
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For \code{ma3x3.matrix}, \code{x} is an arbitrary function.
for \code{ma3x3.spotted}, each column of \code{x} is assumed to contain the expression values of a spotted array in standard order.
The printer layout information is used to re-arrange the values of each column as a spatial matrix before applying \code{ma3x3.matrix}.
\end{Details}
\begin{Value}
Numeric matrix of same dimension as \code{x} containing smoothed values
\end{Value}
\begin{Author}\relax
Gordon Smyth
\end{Author}
\begin{SeeAlso}\relax
An overview of functions for background correction are given in \code{\LinkA{04.Background}{04.Background}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- matrix(c(2,5,3,1,6,3,10,12,4,6,4,8,2,1,9,0),4,4)
ma3x3.matrix(x,FUN="mean")
ma3x3.matrix(x,FUN="min")
\end{ExampleCode}
\end{Examples}


