MathGroup Archive 1997

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

Search the Archive

How do I use BooleanSelect?


BooleanSelect is a function in the DataManipulation.m add on package
in Statistics.  It doesn't seem to work.  Here's some background on it
as well as TakeWhile which does work:

??BooleanSelect

"BooleanSelect[list, sel] keeps elements of list for which the
corresponding element of sel is True."
Attributes[BooleanSelect] = {Protected, ReadProtected}

??TakeWhile

"TakeWhile[list, pred] takes elements from the beginning of list while
pred is True."
Attributes[TakeWhile] = {Protected, ReadProtected}

Here is some test data I have been using to explore these functions:

testa = {1,2,3,4,-2,y,6,7};
testb={{1,2},{-2,3},{23,56},{90,54},{-2,-200}};

The function TakeWhile works in the following way:

TakeWhile[testa,NumberQ]

Out[16]={1,2,3,4,-2}

Boolean Select does not:

BooleanSelect[testa,NumberQ]

Out[21]=BooleanSelect[{1,2,3,4,-2,y,6,7},NumberQ]

What I really need is a working function like BooleanSelect that will
let me sort through arrays, like "testb".  I need to screen out all
groups in testb that either have -2 or -200 as an element.  For
example:

BooleanSelect[testb,???]

{{1,2},{23,56},{90,54}};

There must be a way.  What is it?



  • Prev by Date: Re: wrong divergence?!?
  • Next by Date: Re: Problems with TimeConstrained in Win3.1
  • Previous by thread: Re: How do I use BooleanSelect?
  • Next by thread: Re: How do I use BooleanSelect?