wtd.table: detect duplications using duplicated() instead of diff(x) to handle Inf.  Thanks: Benjamin Tyner