stats::row -- select and re-arrange
rows of a sample
Introductionstats::row(s, ..) creates a new sample
from selected rows of the sample s.
Call(s)stats::row(s, r1 <, r2, ..>)
stats::row(s, r1..r2 <, r3..r4, ..>)
Parameterss |
- | a sample of domain type stats::sample. |
r1, r2, .. |
- | positive integers representing row indices of the
sample s. |
Returnsa sample of domain type stats::sample.
Related
Functionsstats::col, stats::concatCol, stats::concatRow, stats::selectRow
Detailsstats::row is useful for selecting rows of interest or
for re-arranging rows.s specified by the remaining arguments of
stats::row are used to build a new sample. The new sample
contains the rows of s in the order specified by the call
to stats::row. Rows can be duplicated by specifying the
row index more than once.
Example
1The following sample represents the ``population'' of a small town:
>> stats::sample([["1990", 10564], ["1991", 10956],
["1992", 11007], ["1993", 11123],
["1994", 11400], ["1995", 11645]])
"1990" 10564
"1991" 10956
"1992" 11007
"1993" 11123
"1994" 11400
"1995" 11645
We are only interested in the years 1990, 1991, 1992 and 1995. We create a new sample containing the rows of interest:
>> stats::row(%, 1..3, 6)
"1990" 10564
"1991" 10956
"1992" 11007
"1995" 11645
We reorder the sample:
>> stats::row(%, 4, 3, 2, 1)
"1995" 11645
"1992" 11007
"1991" 10956
"1990" 10564