This article describes how to customize the formatting of Displayr's tables, similar to what's possible in Excel. This applies to built-in drag and drop tables as well as basic R tables. 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
- Worked Example: Setting row heights and column width
- FAQ
Requirements
-
A table with a format as one of the following:
- Built-in drag-and-drop table. For more information, see: Creating Summary Tables and Crosstabs.
- A basic R-based table, such as a combined table, pasted or entered table, or a table created using a custom calculation.
- A Calculation Grid, see How to Use Calculation Grid in Displayr.
- See How to Select the Type of Table that is Right for You for more information about the types of tables available.
-
Tables specifically that cannot be customized per this article are:
-
Table with Custom Formatting (also known as Autofit) and any other table created via the Visualization > Specialty Tables menu. These must be customized via the Chart or Data tab in Properties
.
- Custom tables created via R Code with the CreateCustomTable(), formattable, or DT functions. These are HTML based, and any HTML based table created must be customized via the code.
-
Table with Custom Formatting (also known as Autofit) and any other table created via the Visualization > Specialty Tables menu. These must be customized via the Chart or Data tab in Properties
Format Entire Tables
Click a table so that the entire object is selected. Go to Properties and select the Appearance > Appearance menu.
The following properties can be customized:
- Font family and size
- Significance testing
- Decimals and Number format
- Built-in Table style
- Table panes, such as freezing row/column names when scrolling
- Modify output labels for renaming statistics or other labels (e.g., NET)
- 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 Properties 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 formatting changes to the original default
You can also use Table Rules to format the Cells area of a table. Typically this is limited to fill color, significance, and decimals.
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:
- Select the table, right-click > Reset > Table Formats, or click Appearance > Appearance > Reset formatting in Properties
.
-
Select the cell or cell(s), right-click > Reset > Cell Formatting, or click Appearance > Appearance > Reset formatting in Properties
.
Worked Example: Formatting a column of cells
Let's format the first column of the table to add more decimal places.
1. 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.
2. Select Appearance > Appearance > Decimals and click the Increase decimals button until you get the desired precision.
3. To revert to the default formats, right-click the highlighted cells and select Reset > Cell Formatting.
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.
- Select the cell.
- Select Appearance > Appearance > Font and click
to change the font to Bold.
- Increase the font size value to the desired size. In this example, we changed it from 10 to 12.
The results are as follows:
Worked Example: Setting column width and row height
Let's format the table below so that all row labels appear on the same line and column labels span two lines.
- Click on the border of the first column and drag it to the right until all row labels appear on a single line. Alternatively, select the first column header and set the column width (in pixels) in Appearance > Appearance > Layout > Column width in Properties
.
- Select all remaining columns, and drag the border of one of them to the right until all labels appear in two rows. Alternatively, set the width of the selected columns (in pixels) in Appearance > Appearance > Layout > Column width in Properties
.
- The same applies to row height. Select a row or rows and drag the border to the desired height. Alternatively, set the height of the selected rows (in pixels) in Appearance > Appearance > Layout > Row height in Properties
.
- To revert to the default column width or row height, select the table headers, right-click > Reset > Reset Column Width or Row Height. Alternatively, go to Appearance > Appearance > Layout and select Reset column width or Reset row height in Properties
.
Note: Only tables on a Page can be resized. Tables added directly to the Report tree can't be resized.
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.
FAQ
- How can I remove the row headers or row numbers from a table?
- You must convert your basic table into a special autofit table (if not already). You can do this by either:
- Create a CreateCustomTable table and use
show.row.headers = FALSE - Go to Visualization > Specialty Tables > Table with Custom Formatting, table, and uncheck Chart > Row Header > Show row headers in Properties
.
- Create a CreateCustomTable table and use
- You must convert your basic table into a special autofit table (if not already). You can do this by either:
Next
How to Customize Default Row and Column Labels in Displayr Tables
How to Add a Custom Table Footnote
UPCOMING WEBINAR: From Thousands of Tables To One Clear Story: using AI in survey analysis