I have a nested array of numbers, arranged as follows:
ids = [[5,8,10],[8,7,25],[15,30,32],[10,8,7]]
I only need one array with all the keys inside, without repetition, so I used this:
ids = ids.flatten.uniq
This creates the following:
ids = [5,8,10,7,25,15,30,32]
Since I used .uniq , it eliminates duplicate values. However, I would like to order values โโdepending on how often they appear in sub-arrays, and not depending on what order they are in - here is something like this:
ids = [8,10,7,5,25,15,30,32]