\Header{sizeDiss}{Sample Size of Dissimilarity Like Object}
\keyword{utilities}{sizeDiss}
\keyword{arith}{sizeDiss}
\begin{Description}\relax
Returns the number of observations (\emph{sample size}) corresponding
to a  dissimilarity like object, or equivalently,
the number of rows or columns of a matrix
when only the lower or upper triangular part (without diagonal) is given.

It is nothing else but the inverse function of \eqn{f(n) = n(n-1)/2}{}.\end{Description}
\begin{Usage}
\begin{verbatim}
sizeDiss(d)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{d}] any \R{} object with length (typically) \eqn{n(n-1)/2}{}.
\end{ldescription}
\end{Arguments}
\begin{Value}
a number; \eqn{n}{} if \code{length(d) == n(n-1)/2}, \code{NA} otherwise.\end{Value}
\begin{SeeAlso}\relax
\code{\Link{dissimilarity.object}} and also
\code{\Link{as.dist}} for class \code{dissimilarity} and
\code{dist} objects which have a \code{Size} attribute.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
sizeDiss(1:10)# 5, since 10 == 5 * (5 - 1) / 2
sizeDiss(1:9) # NA

n <- 1:100
stopifnot(n == sapply( n*(n-1)/2, function(n) sizeDiss(logical(n))))
\end{ExampleCode}
\end{Examples}

