NUMBERS inputVector {inputVector} resultVariable

Replaces the contents of the result variable with the contents of the input vector(s) concatenated in the order of their listing.

In Resampling Stats, the NUMBERS command was limited to only one input vector. In Statistics101, the command has been generalized to allow input of any number and mix of input vectors and/or any kind of literal list, literal sequence, or multiple literal (quantity#value). See Using the Sequence and Multiple Operators.

The following commands are synonyms for the NUMBERS command: COPY, DATA, URN and CONCAT. They are all identical except for their names. Use whichever name is most meaningful in context.


NUMBERS 1,5 A
NUMBERS (5 6 8 14 20) B
NUMBERS 4#5 C
PRINT A B C

The above program produces the following output:

A: (1.0 2.0 3.0 4.0 5.0)
B: (5.0 6.0 8.0 14.0 20.0)
C: (5.0 5.0 5.0 5.0)

The next program...

NUMBERS 4,1 (2 3 5) 3#9 2 5 A
PRINT A

...produced this output:

A: (4.0 3.0 2.0 1.0 2.0 3.0 5.0 9.0 9.0 9.0 2.0 5.0)

If you want to concatenate one or more vectors onto the beginning or end of another vector, you would do it like this:

NUMBERS 1,5 A     'original vector
NUMBERS 10,20 A A 'add 10,20 to start of A
'or
NUMBERS A 10,20 A 'add 10,20 to end of A

Here's a practical example: When choosing 2 students at random from a class of 10 boys and 15 girls, what is the probability of their both being girls?

NAME boy girl
NUMBERS 10#boy 15#girl students
COPY 1000 repeatCount
COPY 0 successCount
REPEAT repeatCount
   SAMPLE 2 students winners
   COUNT winners = girl girlCount
   IF girlCount = 2
      ADD 1 successCount successCount
   END
END
DIVIDE successCount repeatCount probability
PRINT probability

The above program produces the following output:

probability: 0.353