Multiway tables in Displayr are akin to pivot tables in Excel, so they are useful when wanting to see counts or aggregate numeric data across all combinations of categories in multiple variable sets. However, they are a special kind of R-based table and do not include the default stat testing applied to the built-in drag and drop tables. If significance testing is needed, you will need to use the filter one variable set by another automation, see How to Rebase One Question Based on Another Question.
This article describes how to create a table with multiple categorical variables and, optionally, a numeric variable. Similar to a pivot table in Excel.
Requirements
A Displayr document with a data set.
Method
- From the toolbar, go to Table
> Multiway.
- In the object inspector, go to Data > Rows and select the rows for the table.
- OPTIONAL: In Data > Columns select the columns for the table.
- OPTIONAL: Select a numeric variable in the Numeric drop-down.
- Select the Statistic to show in the table.
- OPTIONAL: Tick the Hide empty rows and Hide empty columns boxes if you wish to hide where there is no data.
- OPTIONAL: This output doesn't have the standard customization options for drag and drop and specialty tables, but you can still customize it to your liking.
- You can use the Appearance tab in the object inspector to customize colors, font, decimals, and borders on the table.
- To relabel categories in the Rows, you can change those on a drag and drop Summary of the variable set, or you can use R code if you prefer.
- To relabel column headers, you will need to edit the R code, see Additional Notes below.
Additional Notes
To rename column headers in a multiway table:
- In the object inspector for the table, on the Data tab click Show Advanced Options > R Code > Edit code to open the Code Editor.
- Notice the name of your multiway table on line 9 (the example's is
multiwayin the orange box in the picture below). Add two lines at the bottom of the code to rename the columns and return the final table again.#change multiway below to the name of your table
#put new column labels inside "" in the c() below
colnames(multiway)=c("Preferred Cola","Male","Female")
multiway
UPCOMING WEBINAR: 10 Market Research Predictions Over the Next 4 Years