# How can I efficiently enter multiple instances of data?

I would like to plot the normal distribution for a population of human heights.

My question is how can I input multiple frequencies for the same variable, without writing them out one by one.

e.g. I have 17 instances of 5'10", 20 of 5'11", 4 of 6'.

• Have a look at ConstantArray and Join. Jan 19, 2013 at 14:18

 Join[
Table[Quantity["5 feet 11 inches"], {7}],
Table[Quantity["5 feet 10 inches"], {20}]
]


So there are three things going on here -- we are using Mathematica Version 9 Quantity for things with units, Table to make individual lists of a given length, and Join to concatenate them.

You could also use ConstantArray instead of Table, and various different input forms of "5 feet 10 inches", etc.

• I found it interesting that "5 feet 11 inches" becomes $5'11"$ which is, in FullForm, Quantity[MixedRadix[5, 11], MixedRadix["Feet", "Inches"] Jan 19, 2013 at 17:34
Table[5.10, {17}]


Should do the trick

1. Table is best used for things that change while ConstantArray is optimized for repetition of a single element.

2. Rather than typing either several times it will be faster to use Apply.

3. Entering pairs of values is done more quickly with matrix entry tools than nested brackets.  (Flatten or Join can be used to merge sub-lists into one. I am using pre-v9 units in this example.)

All this said there may be a better way to "plot the normal distribution."