Statistics - Maple Programming Help

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

Statistics

 SelectInRange
 select data items in a given range
 RemoveInRange
 remove data items in a given range

 Calling Sequence SelectInRange(X, R, options) RemoveInRange(X, R, options)

Parameters

 X - R - data range options - (optional) equation of the form include=value

Description

 • The SelectInRange function selects all items from X which belong to the specified range R and returns them in a new data sample with the same options as X.
 • The first parameter X is a data sample - given as e.g. a Vector.
 • The second parameter R is the range. By default the range R is considered closed from the left and open from the right. This can be changed using the include option.
 • The RemoveInRange function does the opposite of SelectInRange. It removes all data items from X which belong to the range R.

Options

 The options argument can contain the following option:
 • include=left, right or [left, right] -- Specify whether the endpoints should be included in the interval. By default, the interval defined by R is considered closed on the left and open on the right.

Notes

 • Each element of X can be any Maple expression, but this expression must be able to be evaluated to a floating-point number. Failure to do so will generate an error.
 • The SelectInRange and RemoveInRange commands leave the original data set X unchanged.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $l≔\left[3,2,1,\mathrm{π},\mathrm{undefined}\right]$
 ${l}{:=}\left[{3}{,}{2}{,}{1}{,}{\mathrm{π}}{,}{\mathrm{undefined}}\right]$ (1)
 > $\mathrm{RemoveInRange}\left(l,1..3\right)$
 $\left[{3}{,}{\mathrm{π}}{,}{\mathrm{undefined}}\right]$ (2)
 > $\mathrm{SelectInRange}\left(l,1..3\right)$
 $\left[{2}{,}{1}\right]$ (3)
 > $\mathrm{SelectInRange}\left(l,1..3,\mathrm{include}=\mathrm{right}\right)$
 $\left[{3}{,}{2}\right]$ (4)
 > $\mathrm{SelectInRange}\left(l,1..3,\mathrm{include}=\left[\mathrm{left},\mathrm{right}\right]\right)$
 $\left[{3}{,}{2}{,}{1}\right]$ (5)
 > $A≔\mathrm{Array}\left(l\right)$
 ${A}{:=}\left[\begin{array}{ccccc}{3}& {2}& {1}& {\mathrm{π}}& {\mathrm{undefined}}\end{array}\right]$ (6)
 > $\mathrm{RemoveInRange}\left(A,1..3\right)$
 $\left[\begin{array}{ccc}{3}& {\mathrm{π}}& {\mathrm{undefined}}\end{array}\right]$ (7)
 > $\mathrm{SelectInRange}\left(A,1..3\right)$
 $\left[\begin{array}{cc}{2}& {1}\end{array}\right]$ (8)
 > $\mathrm{SelectInRange}\left(A,1..3,\mathrm{include}=\mathrm{right}\right)$
 $\left[\begin{array}{cc}{3}& {2}\end{array}\right]$ (9)
 > $\mathrm{SelectInRange}\left(A,1..3,\mathrm{include}=\left[\mathrm{left},\mathrm{right}\right]\right)$
 $\left[\begin{array}{ccc}{3}& {2}& {1}\end{array}\right]$ (10)