This article describes how to customize the formatting of Displayr's built-in tables and R-based tables, similar to what's possible in Excel. It allows you to turn a table like this:
...into one that looks like this:
More specifically:
- Format Entire Tables
- Format Cells
- Reset to table default formats
- Worked Example: Formatting a column of cells
- Worked Example: Changing the font for a cell
Requirements
- One of Displayr's drag-and-drop tables. For more information, see: Creating Summary Tables and Crosstabs, or
- An R-based table, such as a combined table, pasted or entered table, or a table created using a custom calculation.
Please note this requires the Data Stories module or a Displayr license.
See How to Select the Type of Table that is Right for You for more information about the types of tables available. Note that Autofit tables cannot be customized using the methods described below.
Format Entire Tables
Click a table so that the entire object is selected. Go to the object inspector on the right and select the Appearance > APPEARANCE menu.
The following properties can be customized:
- Font family and size
- Built-in Table style
- Table panes such as freezing row/column names when scrolling
- Significance testing
- Decimals and Number format
- Reset formatting changes to the original default
Format Cells
Click on a cell or cells you want to format. You can also format the row and column headers. Once you've selected your desired cell(s) within a table, go to the object inspector on the right and select the Appearance > APPEARANCE menu.
Using this menu, you can customize the selected cell(s). You can also have multiple formatting styles within the same table.
The following properties can be customized:
- Font type, size, and style
- Paragraph formatting, such as vertical and horizontal alignment within the cell
- Fill color
- Border style, placement, and color
- Significance (note that significance properties apply to the whole table)
- Decimals and Number format
Reset to table default formats
If you need to revert the formatting to the table's initial state, you can reset the table to the default format at any time. To do so:
- Highlight the cell(s) you want to revert to the table default formats.
- Right-click > Reset > Table Formats or click Appearance > APPEARANCE > Reset formatting in the object inspector on the right.
Worked Example: Formatting a column of cells
Let's format the first column of the table to add more decimal places.
- Click the first cell in the column, hold down the Shift key or click and drag, and select all the cells you want to reformat.
- Select Appearance > APPEARANCE > Decimals and click the button until you get the desired precision.
The results are as follows:
- To revert to the default formats, right-click the highlighted cells and select Reset > Table Formats.
The results are as follows:
Worked Example: Changing the font for a cell
Let's say you consider the fact that 33% of respondents Love Coca-Cola an important finding and want it to stand out in the table.
- Click the cell.
- Select Appearance > APPEARANCE > Font and click to change the font to Bold.
- Increase the pitch value to the desired size. In this example, we changed it from 10 to 12.
The results are as follows:
Technical details
For built-in tables (drag-and-drop):
Formats are retained on export to PowerPoint or Excel and are editable in the exported files.
Cell formatting stays with the specific cell it is added to, even when that cell is moved using sorting, Rules, transposing the table, and other methods of changing the look and feel of the table.
For example, the table on the left is not sorted and the table on the right is sorted in descending order based on the "Love + Like" column. The cell shading is retained based on the original shading of each row:
For R-based tables:
Formats are retained on export to PowerPoint or Excel, but are not editable in the exported files.
If the underlying R code changes, data changes, or the table is sorted, the formatting will not 'follow' the cells but will stay where it was.
In the example below, I've sorted the "Love + Like" column in descending order, but the row shading does not follow the cells and remains in an alternating pattern as originally applied:
In addition, once R-based tables are sorted or filtered, cell selection becomes disabled and you will not be able to make cell-specific modifications.
Next
How to Customize Default Row and Column Labels in Displayr Tables
How to Add a Custom Table Footnote
How to Customize Colors on a CreateCustomTable R Table
How to Apply Significance Testing in Displayr