Re: Select All Lists Where Any Element is a Given Value
- To: mathgroup at smc.vnet.net
- Subject: [mg96664] Re: Select All Lists Where Any Element is a Given Value
- From: jonm at wolfram.co.uk
- Date: Thu, 19 Feb 2009 03:35:45 -0500 (EST)
- References: <gncmgo$fkq$1@smc.vnet.net> <gngk16$jjg$1@smc.vnet.net>
One more approach... Cases[X, {___, NA, ___}] On Feb 18, 9:22 am, Peter Breitfeld <ph... at t-online.de> wrote: > Gregory Lypny wrote: > > Hello everyone, > > > Suppose I have the list > > > X = {{1, 2, 3}, {8, NA, 20}, {-7, 9, NA}}, > > > where NA is a string, although it need not be. How can I use Select = > > to pull out all lists in X where NA appears in any element? In this = > > example, I want to pull out the second and third list. > > > Regards, > > > Gregory > > Try: > > Select[X, MemberQ[#, "NA"] &] > > Out={{8, "NA", 20}, {-7, 9, "NA"}} > > -- > _________________________________________________________________ > Peter Breitfeld, Bad Saulgau, Germany --http://www.pBreitfeld.de