Statistics - Maple Programming Help

Home : Support : Online Help : Statistics and Data Analysis : Statistics Package : Data Manipulation : Statistics/Select

Statistics

 Select
 select data items satisfying a condition
 Remove
 remove data items satisfying a condition

 Calling Sequence Select(func, X) Remove(func, X)

Parameters

 func - boolean-valued procedure X - options - (optional) extra arguments to func

Description

 • The Select function selects the items data[i] for which $\mathrm{func}\left({X}_{i},\mathrm{options}\right)$ returns true, and creates a new data sample with the same options as X. Those items for which func does not return true are discarded in the newly created data sample.
 • The Remove function does the opposite of Select. It removes the data items of X which satisfy func and creates a new data set.
 • The first parameter func must be a boolean valued procedure.
 • The second parameter X is a data sample - given as e.g. a Vector. If X is a list, then the procedures select and remove (and selectremove) do the same thing as Select and Remove, but are slightly faster.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $L≔\left[3,3,1,1,a,b,b,a,\mathrm{π},\mathrm{sin}\left(4\right)\right]$
 ${L}{≔}\left[{3}{,}{3}{,}{1}{,}{1}{,}{a}{,}{b}{,}{b}{,}{a}{,}{\mathrm{π}}{,}{\mathrm{sin}}{}\left({4}\right)\right]$ (1)
 > $\mathrm{Select}\left(\mathrm{type},L,\mathrm{realcons}\right)$
 $\left[{3}{,}{3}{,}{1}{,}{1}{,}{\mathrm{π}}{,}{\mathrm{sin}}{}\left({4}\right)\right]$ (2)
 > $\mathrm{Remove}\left(\mathrm{type},L,\mathrm{realcons}\right)$
 $\left[{a}{,}{b}{,}{b}{,}{a}\right]$ (3)
 > $A≔\mathrm{Array}\left(L\right)$
 ${A}{≔}\left[\begin{array}{cccccccccc}{3}& {3}& {1}& {1}& {a}& {b}& {b}& {a}& {\mathrm{π}}& {\mathrm{sin}}{}\left({4}\right)\end{array}\right]$ (4)
 > $\mathrm{Select}\left(\mathrm{type},A,\mathrm{realcons}\right)$
 $\left[\begin{array}{cccccc}{3}& {3}& {1}& {1}& {\mathrm{π}}& {\mathrm{sin}}{}\left({4}\right)\end{array}\right]$ (5)
 > $\mathrm{Select}\left(t→\mathrm{is}\left(0
 $\left[\begin{array}{ccccc}{3}& {3}& {1}& {1}& {\mathrm{π}}\end{array}\right]$ (6)
 > $\mathrm{Remove}\left(\mathrm{type},A,\mathrm{name}\right)$
 $\left[\begin{array}{ccccc}{3}& {3}& {1}& {1}& {\mathrm{sin}}{}\left({4}\right)\end{array}\right]$ (7)