% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Unique.R
\name{Unique}
\alias{Unique}
\title{Find unique values of a vector or unique rows of a matrix and their location}
\usage{
Unique(x, sort = 0, decreasing = 0)
}
\arguments{
\item{x}{a vector or a matrix}

\item{sort}{= 1 to sort the result}
}
\value{
A list of \cr
 \code{value} The unique values \cr
 \code{loc} The list of length \code{length(value)} containing
 the locations of the original elements.
}
\description{
Find unique values of a vector or unique rows of a matrix and their location
}
\examples{
( temp <- Unique( c(1,2,1,5,6,3,5,4,6) ) )
sum( unlist(lapply(temp$loc,length)) )
( temp <- Unique( c(1,2,1,5,6,3,5,4,6), sort=1 ) )

( temp2 <- Unique( rbind(demomat(5,4),demomat(3,4)) ) )
( temp2 <- Unique( rbind(demomat(5,4),demomat(3,4)), sort=1, decreasing=1 ) )

}
