How to | Put Headings in a Table
The Wolfram Language provides great flexibility for displaying and styling headings in a table. You can use Prepend or ArrayFlatten to add headings to rows and columns and then use Grid with any of its styling elements to display them in a table.
Display the data, with column headings, using Grid:
Use MapThread to prepend headings for rows:
To prepare the data for display in a table, use Flatten at level one, which here makes one list of triples. The % symbol specifies the most recent output, which in this case is the grouped data:
Use Length to count the number of observations within each soil type:
Use Range to generate a list of successive integers beginning with 1 and ending with the number of observations within each soil type:
Prepare the numbers for use as row headings by using Flatten to compress them into a single list:
Use ArrayFlatten to add the observation numbers, along with the column heading "Observation", to the data:
Use Grid to display the data in a table:
Use some of the options available in Grid to add styling to the table:
You can also create tables and add headings to them using TableForm.