stats::concatCol --
concatenate samples column-wise
Introductionstats::concatCol(s1, s2, ..) creates a new
sample consisting of the columns of the samples s1,
s2 etc.
Call(s)stats::concatCol(s1, s2 <, s3, ..>)
Parameterss1, s2, .. |
- | samples of domain type stats::sample. Alternatively, lists
may be entered, which are treated as columns of a sample. |
Returnsa sample of domain type stats::sample.
Related
Functionsstats::col, stats::concatRow, stats::row
Detailss1, s2 etc. have different
numbers of rows, then the number of rows in the resulting sample is
given by the ``shortest'' sample with the minimal number of rows.
Elements below this row in ``longer'' samples are ignored.
Example
1We create two samples:
>> s1 := stats::sample([[a1, a2], [b1, b2]]); s2 := stats::sample([[a3, a4], [b3, b4]])
a1 a2
b1 b2
a3 a4
b3 b4
Concatenation of the columns yields:
>> stats::concatCol(s1, s2)
a1 a2 a3 a4
b1 b2 b3 b4
>> delete s1, s2:
Example
2The following sample contains columns for ``gender'', ``age'' and ``height'' of a person:
>> stats::sample([["m", 26, 180], ["f", 22, 160],
["f", 48, 155], ["m", 30, 172]])
"m" 26 180
"f" 22 160
"f" 48 155
"m" 30 172
We append a further column ``nationality'', specified by a list:
>> stats::concatCol(%, ["German", "French", "Italian",
"British", "German"])
"m" 26 180 "German"
"f" 22 160 "French"
"f" 48 155 "Italian"
"m" 30 172 "British"