Re: Select All Lists Where Any Element is a Given Value

*To*: mathgroup at smc.vnet.net*Subject*: [mg96616] Re: [mg96586] Select All Lists Where Any Element is a Given Value*From*: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>*Date*: Tue, 17 Feb 2009 06:26:53 -0500 (EST)*References*: <200902162140.QAA16030@smc.vnet.net>

In[1]:= X = {{1, 2, 3}, {8, NA, 20}, {-7, 9, NA}}; In[2]:= Select[X, MemberQ[#1, NA] & ] Out[2]= {{8, NA, 20}, {-7, 9, NA}} In[3]:= Cases[X, {___, NA, ___}] Out[3]= {{8, NA, 20}, {-7, 9, NA}} Adriano Pascoletti 2009/2/16 Gregory Lypny <gregory.lypny at videotron.ca> > 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 > > >

**References**:**Select All Lists Where Any Element is a Given Value***From:*Gregory Lypny <gregory.lypny@videotron.ca>