[R] unique with tolerance

Michael Bach phaebz at gmail.com
Thu Sep 6 19:55:06 CEST 2012


On 9/6/2012 7:24 PM, Bert Gunter wrote:
> ... and if it Duncan's suggestion won't do, maybe approaching it via
> clustering might be useful.
> But do note that, as stated, the problem is not well defined, because
> transitivity fails: consider
>
> v <- c(1,2,3,4,5,10)
>
> with a tolerance of <=2. Then 1 is the same as 2 and 3, 2 and 3 are
> the same as 4, but 1 is not the same as 4, etc. Exactly what would you
> choose as the "unique" values with this tolerance in this situation?
>

Thanks, good point. In my case the tolerance was much lower than the 
actual values, so I chose Duncan's rounding approach.

Michael




More information about the R-help mailing list