psi.tied.Rd
Determines which elements of a vector are tied.
psi.tied(x)
x | a numeric vector |
---|
Unlike duplicated
, this function returns all tied elements.
a logical vector with the value TRUE at the positions of the tied elements.
#> [1] FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUEduplicated(v1)#> [1] FALSE FALSE FALSE FALSE FALSE TRUE TRUE FALSE TRUE TRUE TRUE TRUEd1 <- 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