Bart Joosen <bartjoosen <at> hotmail.com> writes:

> 
> Hi,
> 
> I have an integer which is extracted from a dataframe, which is sorted by
another column of the dataframe.
> Now I would like to remove some elements of the integer, which are near to
others by their value. For example:
> integer: c(1,20,2,21) should be c(1,20).

....
> Sorting the integer is not an option, the order is important.

Why not? It's extremely efficient for large series and the only method that
would work with large array. The idea: Keep the indexes of the sort order, mark
the "near others" for example making their index NA, and restore original order.
No for-loop needed.

Dieter

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to