Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Arrange the elements of the argument in a two-dimensional grid with row coloring that helps comprehension
ResourceFunction["GridTableForm"][arg] arranges the elements of arg in a two-dimensional grid. |
| "RowBackground" | {White,GrayLevel[0.96]} | alternating row backgrounds |
| TableHeadings | Automatic | row and column table headings |
| "TableHeadingsStyle" | {Blue,FontFamily -> ”Times”} | style applied to the table headings |
Here is a grid table form of a full integer array:
| In[1]:= |
| Out[2]= | ![]() |
Here is a grid table form of a nested list of integers that is not a full array:
| In[3]:= |
| Out[3]= | ![]() |
Table headings can be specified:
| In[4]:= |
| Out[4]= | ![]() |
If needed, various completions of the data and table headings are made in order to produce the final tabular form:
| In[5]:= |
| Out[5]= | ![]() |
GridTableForm can be invoked over Dataset objects; if the dataset has column names, then they are used as table headings:
| In[6]:= | ![]() |
| In[7]:= |
| Out[7]= | ![]() |
GridTableForm can be invoked over Tabular objects; if the tabular object has column names, then they are used as table headings:
| In[8]:= | ![]() |
| Out[10]= | ![]() |
| In[11]:= |
| Out[11]= | ![]() |
Excess table headings are ignored:
| In[12]:= |
| Out[12]= | ![]() |
The following table demonstrates the effect of different row background specifications:
| In[13]:= | ![]() |
| Out[14]= | ![]() |
The following table demonstrates the effect of different table headings specifications:
| In[15]:= | ![]() |
| Out[16]= | ![]() |
If the row headings or column headings are too short, they are completed with SpanFromAbove and SpanFromLeft, respectively:
| In[17]:= |
| Out[17]= | ![]() |
Show a sample of machine learning data with corresponding variable names:
| In[19]:= | ![]() |
| Out[20]= | ![]() |
When studying data arrays, the use of the ResourceFunction RecordsSummary can be completed with GridTableForm:
| In[21]:= |
| In[22]:= |
| Out[22]= | ![]() |
| In[23]:= |
| Out[23]= | ![]() |
Show all rows and columns of a dataset:
| In[24]:= | ![]() |
| Out[22]= | ![]() |
GridTableForm is related to both TableForm and Grid. The relation with TableForm can be seen in this example:
| In[25]:= | ![]() |
| In[26]:= |
| Out[26]= | ![]() |
| In[27]:= |
| Out[27]= | ![]() |
In order to produce a similar result using Grid, several data "augmentations" and option specifications have to be made:
| In[28]:= |
| Out[28]= | ![]() |
If the specified table headings are styled, the specification given to the option "TableHeadingsStyle" has no effect:
| In[29]:= |
| Out[29]= | ![]() |
The background is extended for the extended row names:
| In[30]:= |
| Out[30]= | ![]() |
If the specified table headings value is a list with one element, that element is treated as a row names specification. Compare the following examples:
| In[31]:= | ![]() |
| Out[22]= | ![]() |
| In[32]:= |
| Out[32]= | ![]() |
This example is similar to the "neat example" in the function page of TableForm:
| In[33]:= | ![]() |
| Out[33]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License