Determines which elements of a vector are tied.

psi.tied(x)

Arguments

x

a numeric vector

Details

Unlike duplicated, this function returns all tied elements.

Value

a logical vector with the value TRUE at the positions of the tied elements.

See also

Examples

v1 <- sample(1:6,12,replace=TRUE) psi.tied(v1)
#> [1] FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE TRUE TRUE
d1 <- data.frame(v=v1, tied=psi.tied(v1), dup=duplicated(v1)) d1$flag <- ifelse(d1$tied==d1$dup, "", "different") d1 # show the difference between `psi.tied' and `duplicated'
#> v tied dup flag #> 1 6 FALSE FALSE #> 2 3 FALSE FALSE #> 3 2 TRUE FALSE different #> 4 4 TRUE FALSE different #> 5 1 TRUE FALSE different #> 6 1 TRUE TRUE #> 7 1 TRUE TRUE #> 8 5 TRUE FALSE different #> 9 2 TRUE TRUE #> 10 5 TRUE TRUE #> 11 2 TRUE TRUE #> 12 4 TRUE TRUE