Previous Page Next Page Contents

stats::concatCol -- concatenate samples column-wise

Introduction

stats::concatCol(s1, s2, ..) creates a new sample consisting of the columns of the samples s1, s2 etc.

Call(s)

stats::concatCol(s1, s2 <, s3, ..>)

Parameters

s1, s2, .. - samples of domain type stats::sample. Alternatively, lists may be entered, which are treated as columns of a sample.

Returns

a sample of domain type stats::sample.

Related Functions

stats::col, stats::concatRow, stats::row

Details

Example 1

We 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 2

The 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"
      

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000