Overview
Researchers commonly want to export a topline report, which essentially means a summary report of each variable (including variable sets) within the dataset. This can be useful for data checking purposes (e.g., did my skips work as intended?) and for early detection of problems (with a soft launch, or perhaps a mid-field export).
This article explores the ways you can do a topline tab book, using the following two options:
- Using Crunch — using Multitables with a banner that only contains a total column. This allows you to put many statistics in the topline report at once, as a tab book Excel export (including %s and Ns).
- Using R code — generates a nicely formatted PDF showing either the counts or the percentages.
Using the web app to produce a tab book (Excel)
You can use the web app to produce a formatted topline report, which involves manipulating Crunch to produce the output you want. The following procedure is available at the time this article was written, and may even become a one-click solution in a future release.
The Variable Summaries View itself (the default view of all the variable cards) is, in essence, a topline report: it just happens to be online, and in fact it's better than a typically topline report because:
- You can easily jump around to a particular variable (as well as scrolling through variables)
- You can easily share this with clients
To create a hard copy report in the Crunch web app:
- Go to the Create Variable options (bottom-left + button) and create a Combined variable (see here for instructions):
- Pick a variable (any will do), such as Gender, and then combine all the categories and name it Total (as seen in the image).
- Click Save.
- Create a Multitable using the variable made in step #2 as the only variable (the total) involved (in the banner).
- Export your tab book.
Using R to generate a topline report (in PDF)
You can use R to generate a PDF report using the crunchtabs library. This approach is only meant for users who understand R.
To generate a PDF using R:
- Install the crunchtabs package. You can use the following command to install it:
remotes::install_github("Crunch-io/crunchtabs")
- Log in to your dataset with the R Studio.
- Specify the variables you want to include using their aliases and then store it (e.g., as toplines_summary):
library(crunchtabs) toplines_summary <- crosstabs(dataset = ds[c('track','freepress')])
- Enter the following command to output to PDF, specifying if you want the percentages (the default, line 1) or the counts (line 2):
writeLatex(toplines_summary, filename = 'topline-example', pdf=TRUE) writeLatex(toplines_summary, filename = 'topline-example-counts', pdf=TRUE, proportions=FALSE)