MathGroup Archive 2009

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

Search the Archive

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


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


  • Prev by Date: Re: Factor by Grouping
  • Next by Date: Re: Factor by Grouping
  • Previous by thread: Re: Select All Lists Where Any Element is a Given Value
  • Next by thread: Re: Select All Lists Where Any Element is a Given Value