This article describes how to go from a standard table...
...to a CreateCustomTable R table (similar to a table with Autofit checked) with span column labels:
Requirements
A table
Please note these steps require a Displayr license.
Method
1. Select your table.
2. Copy the name from General > General > Name.
3. Go to Calculation > Custom Code.
4. Paste the below under General > R Code:
#identify mytable
mytable = table.Gender.by.Income
#create list of column spans
colspans = list(list(width=1,label=" "),
list(width=2,label="Low Income"),
list(width=3,label="Med Income"),
list(width=4,label="High Income"),
list(width=1,label=" "))
# #create custom table
flipFormat::CreateCustomTable(mytable,
col.spans=colspans,
border.color = "black")
- The above code defines the table using the reference name from step 2.
- Next, we create a list of the span labels where the width represents the number of columns 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 colspans into the col.spans argument.
5. OPTIONAL: Add other arguments to CreateCustomTable to set fill colors, padding, and font styles.
See Also