Re: On partitioning lists by intervals
- To: mathgroup at smc.vnet.net
- Subject: [mg80438] Re: [mg80396] On partitioning lists by intervals
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 22 Aug 2007 04:50:17 -0400 (EDT)
- Reply-to: hanlonr at cox.net
data = RandomInteger[{0, 100}, 500]; p1 = Table[Select[data, 10*n <= # < 10*(n + 1) &], {n, 0, 10}]; p2 = Table[Cases[data, _?(10*n <= # < 10*(n + 1) &)], {n, 0, 10}]; p3 = BinLists[data, {0, 110, 10}]; p1 == p2 == p3 True Bob Hanlon ---- Mauricio Esteban Cuak <cuak2000 at gmail.com> wrote: > Hello there. > I'm just starting in mathematica and I realise this is a very basic > question, but I tried to find an answer on the documentation center > for a couple of hours and on the archive for mathgroup, but couldn't > find it. > I have a list of say 500 different random values. I need to divide it > in n intervals of fixed length (for example, the lowest value is 0 and > the maximum 100 so I need to get sublists of values that go from 0 to > 10, 10 to 20, etc.) > Thanks for your help! > > cd >