Unique {lazy.tools}R Documentation

Find unique values of a vector or unique rows of a matrix and their location

Description

Find unique values of a vector or unique rows of a matrix and their location

Usage

Unique(x, sort = 0, decreasing = 0)

Arguments

x

a vector or a matrix

sort

= 1 to sort the result

Value

A list of
value The unique values
loc The list of length length(value) containing the locations of the original elements.

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 ) )


[Package lazy.tools version 0.1.4 ]