This article describes how to go from a standard table...
...to a CreateCustomTable R table (similar to a table with Autofit checked) with span row labels:
Method
1. In the toolbar, go to Insert a calculation > custom code. Click-and-drag the crosshairs to create an output on the Page.
2. In the code editor, type in mytable =
and position the cursor after the = sign.
3. On the Page, hover over the original table, and click the table's reference name in the top left to insert it into your code.
4. Now paste in the following below that first line to calculate the averages:
#identify mytable
mytable = table.Income
#create list of row spans
rowspans = list(list(height=2,label="Low Income"),
list(height=3,label="Med Income"),
list(height=4,label="High Income"),
list(height=1,label=" "))
#create custom table
flipFormat::CreateCustomTable(mytable,
row.spans=rowspans,
border.color = "black")
- The code creates a list of the span labels where the height represents the number of rows the span should cover and the label is what should appear within the span.
- Finally, we use our CreateCustomTable function from the flipFormat R package and parse rowspans into the row.spans argument.
6. OPTIONAL: Add other arguments to CreateCustomTable to set fill colors, padding, and font styles.