Re: Data manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg37702] Re: Data manipulation
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 9 Nov 2002 00:29:02 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <aqfp8e$7d9$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
Select[data, First[#] >= 2 && First[#] <= 4 &]
Regards
Jens
Adam Smith wrote:
>
> I know that this has been covered before, but I could not find it.
>
> I have a list of data and I want to select a subset based on a
> condition.
>
> A simple example:
>
> data =
> {{0.39501, 10}, {1.65689, 20}, {2.40239, 30}, {3.27252, 40}, {4.41738,
> 50}}
>
> I want to select only the pairs for which the first element of each
> pair is greater than or equal to 2.0 and less than 4.0 In this case
> the final result would be
>
> {{2.40239, 30}, {3.27252, 40}}
>
> In reality the list is several hundred pairs.
>
> Thanks
>
> Adam