\Header{lower.tri}{Lower and Upper Triangular Part of a Matrix}
\alias{upper.tri}{lower.tri}
\keyword{array}{lower.tri}
\begin{Usage}
\begin{verbatim}
lower.tri(x, diag=FALSE)
upper.tri(x, diag=FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x}] a matrix.
\item[\texttt{diag}] logical. Should the diagonal be included?
\end{ldescription}
\end{Arguments}
\begin{Value}
Returns a \bold{\texttt{\Link{logical}}} matrix of the same dimension as
\texttt{x} which is \texttt{TRUE} for the relevant triangular part of \texttt{x}.\end{Value}
\begin{SeeAlso}
\texttt{\Link{diag}}, \texttt{\Link{matrix}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
m2 <- ma <- matrix(1:20, 4, 5)
m2[lower.tri(m2)] <- NA
m2
all(lower.tri(ma) == !upper.tri(ma, diag=TRUE))
\end{ExampleCode}
\end{Examples}

