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]= | ![]() |
Excess table headings are ignored:
In[8]:= | ![]() |
Out[8]= | ![]() |
The following table demonstrates the effect of different row background specifications:
In[9]:= | ![]() |
Out[10]= | ![]() |
The following table demonstrates the effect of different table headings specifications:
In[11]:= | ![]() |
Out[12]= | ![]() |
If the row headings or column headings are too short, they are completed with SpanFromAbove and SpanFromLeft, respectively:
In[13]:= | ![]() |
Out[13]= | ![]() |
GridTableForm takes all options of Grid:
In[14]:= | ![]() |
Out[7]= | ![]() |
Show a sample of machine learning data with corresponding variable names:
In[15]:= | ![]() |
Out[16]= | ![]() |
When studying data arrays, the use of the ResourceFunction RecordsSummary can be completed with GridTableForm:
In[17]:= | ![]() |
In[18]:= | ![]() |
Out[18]= | ![]() |
In[19]:= | ![]() |
Out[19]= | ![]() |
Show all rows and columns of a dataset:
In[20]:= | ![]() |
Out[22]= | ![]() |
GridTableForm is related to both TableForm and Grid. The relation with TableForm can be seen in this example:
In[23]:= | ![]() |
In[24]:= | ![]() |
Out[24]= | ![]() |
In[25]:= | ![]() |
Out[25]= | ![]() |
In order to produce a similar result using Grid, several data "augmentations" and option specifications have to be made:
In[26]:= | ![]() |
Out[26]= | ![]() |
If the specified table headings are styled, the specification given to the option "TableHeadingsStyle" has no effect:
In[27]:= | ![]() |
Out[27]= | ![]() |
The background is extended for the extended row names:
In[28]:= | ![]() |
Out[28]= | ![]() |
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[29]:= | ![]() |
Out[18]= | ![]() |
In[30]:= | ![]() |
Out[30]= | ![]() |
This example is similar to the "neat example" in the function page of TableForm:
In[31]:= | ![]() |
Out[31]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License