## `stats::selectRow` -- select rows of a sample

#### Introduction

`stats::selectRow``(s, ..)` selects rows of the sample `s` having specific entries in specific places.

#### Call(s)

`stats::selectRow(s, c, x <, Not>)`
`stats::selectRow(s, [c1, c2, ..], [x1, x2, ..] <, Not>)`

#### Parameters

`s` | - | a sample of domain type `stats::sample`.
`c, c1, c2, ..` | - | integers representing column indices of the sample `s`.
`x, x1, x2, ..` | - | arithmetical expressions.

#### Options

`Not` | - | causes `stats::selectRow` to select those rows which do not have the specified entries.

#### Returns

a sample of domain type `stats::sample`.

#### Related Functions

`stats::row`

#### Details

- `stats::selectRow``(s, c, x)` returns a sample consisting of all rows in `s`, which contain the data element `x` at the position `c`.
- `stats::selectRow``(s, [c1, c2, ..], [x1, x2, ..])` returns a sample consisting of all rows in `s`, which contain the data element `x1` at the position `c1` and `x2` at the position `c2` etc. There must be as many positions `c1`, `c2`,...as data elements `x1`, `x2`,....

#### Example 1

We create a sample with two columns:

    >> stats::sample([[a, 5], [c, 1], [a, 2], [b, 3]])

                                      a  5
                                      c  1
                                      a  2
                                      b  3

We select all rows with `a` as their first entry:

    >> stats::selectRow(%, 1, a)

                                      a  5
                                      a  2

#### Example 2

We create a sample containing income and costs in the years 1997 and 1998:

    >> stats::sample([[123, "costs", "97"], [442, "income", "98"],
                      [11, "costs", "98"], [623, "income", "97"]])

                               123  "costs"   "97"
                               442  "income"  "98"
                                11  "costs"   "98"
                               623  "income"  "97"

We select the row which has `"income"` in the second and `"97"` in the third column:

    >> stats::selectRow(%, [2, 3], ["income", "97"])

                               623  "income"  "97"

We select the remaining rows:

    >> stats::selectRow(%2, [2, 3], ["income", "97"], Not)

                               123  "costs"   "97"
                               442  "income"  "98"
                                11  "costs"   "98"

#### Changes

- new function

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000