\Header{duplicated}{Determine Duplicate Elements}
\keyword{logic}{duplicated}
\keyword{manip}{duplicated}
\begin{Description}\relax
Determines which elements of a vector are duplicates
of elements with smaller subscripts, and returns a
logical vector indicating which elements are duplicates.\end{Description}
\begin{Usage}
\begin{verbatim}
duplicated(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an atomic vector
\end{ldescription}
\end{Arguments}
\begin{SeeAlso}\relax
\code{\Link{unique}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x <- c(9:20, 1:5, 3:7, 0:8)
## extract unique elements
(xu <- x[!duplicated(x)])
stopifnot(xu == unique(x), # but unique(x) is more efficient
          0:20 == sort(x[!duplicated(x)]))
\end{ExampleCode}
\end{Examples}

