\HeaderA{sd}{Standard Deviation}{sd}
\keyword{univar}{sd}
\begin{Description}\relax
This function computes the standard deviation of the values in
\code{x}.
If \code{na.rm} is \code{TRUE} then missing values are removed before
computation proceeds.
If \code{x} is a matrix or a data frame, a vector of the standard
deviation of the columns is returned.
\end{Description}
\begin{Usage}
\begin{verbatim}
sd(x, na.rm = FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a numeric vector, matrix or data frame. An object which is
not a vector, matrix or data frame is coerced (if possible)
by \code{as.vector}.
\item[\code{na.rm}] logical. Should missing values be removed?
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Like \code{\LinkA{var}{var}} this uses denominator \eqn{n - 1}{}.

The standard deviation of a zero-length vector (after removal of
\code{NA}s if \code{na.rm = TRUE}) is not defined and gives an error.
The standard deviation of a length-one vector is \code{NA}.
\end{Details}
\begin{SeeAlso}\relax
\code{\LinkA{var}{var}} for its square, and \code{\LinkA{mad}{mad}}, the most
robust alternative.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
sd(1:2) ^ 2
\end{ExampleCode}
\end{Examples}

