COPY 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 COPY 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 operator (quantity#vector). See Using the Sequence and Multiple Operators.

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

COPY 1,5 A
COPY (5 6 8 14 20) B
COPY 4#5 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...

COPY 4,1 (2 3 5) 3#9 2 5 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:

COPY 1,5 A     'original vector
COPY 10,20 A A 'add 10,20 to start of A
COPY 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
COPY 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
DIVIDE successCount repeatCount probability
PRINT probability

The above program produces the following output:

probability: 0.353