Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: On partitioning lists by intervals

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80426] Re: [mg80396] On partitioning lists by intervals
  • From: DrMajorBob <drmajorbob at bigfoot.com>
  • Date: Wed, 22 Aug 2007 04:43:54 -0400 (EDT)
  • References: <27114948.1187714158061.JavaMail.root@m35>
  • Reply-to: drmajorbob at bigfoot.com

data = RandomInteger[{1, 100}, 200];

BinCounts[data, {0, 100, 10}]

{20, 11, 20, 25, 21, 21, 17, 24, 21, 19}

BinLists[data, {0, 100, 10}]
Length /@ %

{{1, 9, 6, 9, 2, 2, 2, 4, 8, 8, 7, 4, 7, 1, 5, 6, 5, 2, 7, 3}, {19,
   14, 19, 12, 18, 15, 11, 15, 12, 11, 11}, {25, 20, 24, 22, 26, 29,
   29, 27, 20, 26, 20, 27, 25, 23, 24, 24, 25, 23, 26, 24}, {36, 36,
   36, 32, 35, 38, 39, 33, 31, 31, 37, 33, 31, 38, 31, 30, 34, 36, 33,
   37, 37, 32, 37, 37, 32}, {45, 41, 46, 40, 44, 45, 40, 48, 43, 47,
   46, 49, 42, 41, 46, 45, 41, 43, 44, 43, 40}, {57, 59, 52, 57, 55,
   58, 55, 50, 56, 55, 53, 52, 50, 59, 55, 55, 52, 57, 53, 51,
   54}, {67, 61, 64, 66, 62, 63, 66, 64, 65, 62, 61, 63, 63, 61, 65,
   66, 63}, {71, 78, 77, 73, 75, 70, 75, 76, 70, 72, 76, 78, 79, 74,
   70, 72, 71, 78, 78, 71, 70, 72, 76, 77}, {82, 85, 87, 86, 88, 82,
   87, 84, 82, 85, 81, 88, 85, 80, 86, 82, 80, 83, 89, 89, 85}, {95,
   92, 90, 90, 96, 96, 96, 93, 98, 94, 92, 91, 95, 94, 91, 93, 92, 93,
   90}}

{20, 11, 20, 25, 21, 21, 17, 24, 21, 19}

Bobby

On Tue, 21 Aug 2007 04:03:41 -0500, 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
>
>



-- 
DrMajorBob at bigfoot.com


  • Prev by Date: Re: Redefine Arg to return a value from 0 to 2 pi
  • Next by Date: Re: Manipulate with Wrapping SetterBars
  • Previous by thread: Re: On partitioning lists by intervals
  • Next by thread: Re: On partitioning lists by intervals