Sometimes you may need to add appendix tables or tables of raw data to your Displayr document. If you want to add very customized formatting to these tables you can create an Autofit or CreateCustomTable R Table, but these tables try to fit all of the data in the size of the output, which can create tables that are truncated or hard to read. This article describes how to go from an Autofit or CreateCustomTable R table where some of the data is cut off or too scrunched (note the below table actually has 600 rows):
To one that has scrolling enabled:
Requirements
- An Autofit table (see How to Create an Autofit Table) or CreateCustomTable R Table (see How to Align Values to a Visualization Using a CreateCustomTable R Table)
Method - Autofit table
We will edit the underlying R CODE of the autofit table to set the row height to a certain size instead of having row heights "fit" the space available. This will trigger the scroll bar to appear.
- Select your Autofit table.
- Go to Properties > R CODE and use Ctrl+F (Cmd+F on a Mac) to find the line of code for
row.header.labels
- Hit the Enter key (Return on a Mac) to insert a line above it and paste in the code below. This sets a value for
row.height
(note you can change 12px to a different pixel size based on the font size in your table):
row.height = "12px",
- Click Calculate.
- [OPTIONAL] If wanting scrolling compatibility with Firefox, you will need to change the use.predefinted.css to TRUE and add in a new argument for custom.css like:
use.predefined.css = TRUE,
custom.css=" div {
position:absolute;
overflow-y: auto;
overflow-x: hidden;
}"
Method - CreateCustomTable R Table
We will use the row.height argument inside the CreateCustomTable() function to set the height to a certain size instead of having row heights "fit" the space available. This will trigger the scroll bar to show up.
- Click on the Calculation that's using CreateCustomTable().
- In the Properties > R CODE box, inside the flipFormat::CreateCustomTable() function, add a line for the
row.height
argument (note you can change 12px to a different px size based on the font size in your table). For example:
#specify the table to be formatted
mytable = table.Q1a.Spontaneous.Awareness.Spontaneous.Awareness.mention
#format using CreateCustomTable - use row.height to make table scroll
flipFormat::CreateCustomTable(mytable,
row.height="12px") - Click Calculate.
- [OPTIONAL] If wanting scrolling compatibility with Firefox, you will need to add a few more arguments within the CreateCustomTable() like:
use.predefined.css = TRUE,
custom.css=" div {
position:absolute;
overflow-y: auto;
overflow-x: hidden;
}"
Next
How to Create an Autofit Table
How to Align Values to a Visualization Using a CreateCustomTable R Table
How to Customize Colors on a CreateCustomTable R Table
Comments
0 comments
Article is closed for comments.