I am working on a way to create anonymus data. Therefore I want to to some sort of rounding my data. But this should happen in n-groups that have the same range. minimal group should be min(a) and from there on it goes in n steps to max(a)-diff(max(a),min(a))/n
example 1:
a = [10,11,14,15,16.5,17,19]
round_n_groups(x=a,n_groups=5)
returns:
[10,10,14,14,16,16,18]
example 2:
b = [-.5,.1,.7,1.3]
round_n_groups(x=b,n_groups=2)
returns:
[-.5,-.5,.4,.4]