Hi everyone,
i am trying to group close numbers in a vector.
For example i have a vector x = [1 2 4 7 9 10 15].
I want the code to pick 1 2 4 (max difference between successive numbers is
2) and assign them to variable a, then pick 7 9 10 and assign them to b and
15 to c. But since i do not know how many groups there will be the code
should create a,b,c etc as it goes along. So if x = [1 2 4 7 9 10 15 20] it
should create a,b,c and d this time and assign 20 to d (while the others
remain the same).

any help will be appreciated,
thanks,
salih

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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