This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 MATHEMATICA HOW TO Tutorials »| See Also »| More About »
How to | Perform Calculations on Columns of Data
You will often need to perform calculations on the columns in a dataset, particularly when the columns represent variables. While some functions automatically operate on columns of data when a rectangular array is given, others may require some manipulation of the data in order to operate on the columns.
Create some data to work with (SeedRandom ensures a predictable result):
 Out[1]=
Mathematica characterizes data by grouping lists within other lists. Every list is interpreted as a row within the matrix of data:
 Out[2]//MatrixForm=
The Grid function displays data in the same fashion, only without the braces:
 Out[3]=
By default many functions operate on each column when a rectangular list of lists is given as the argument.
Find the mean of each column:
 Out[4]=
Find the standard deviation of the columns:
 Out[5]=
Find the median of each column:
 Out[6]=
You can also select individual columns for calculations. Here, the first column from is selected:
 Out[14]=
 Out[15]=
 Out[16]=
 Out[17]=
For matrices with more than two columns, plot the rows as separate datasets:
 Out[7]=
Plot the columns by transposing the data:
 Out[8]=
For functions that operate on vectors, map the function onto the transposed data to operate on columns:
 Out[9]=
Transpose the result to get a matrix with normalized columns:
 Out[10]=
Transposing and mapping can also be done for functions that flatten their argument:
 Out[11]=