This function allows you to generate a tab book from a multitable and data.
As with other functions, you can select the rows and columns you want to
work with by subsetting the
dataset you pass into the function.
tabBook( multitable, dataset, weight = crunch::weight(dataset), output_format = c("json", "xlsx"), file, filter = NULL, use_legacy_endpoint = envOrOption("use.legacy.tabbook.endpoint", FALSE), ... )
CrunchDataset, which may be subset with a filter expression on the rows, and a selection of variables to use on the columns.
a CrunchVariable that has been designated as a potential
weight variable for
character export format: currently supported values are "json" (default) and "xlsx".
character local filename to write to. A default filename will be
generated from the
Logical, indicating whether to use a 'legacy'
endpoint for compatibility (this endpoint will be removed in the future).
Additional "options" passed to the tab book POST request. More details can be found in the crunch API documentation
If "json" format is requested, the function returns an object of
TabBookResult, containing a list of
objects, which themselves contain
CrunchCubes. If "xlsx" is requested,
the function invisibly returns the filename (
file, if specified, or the
the autogenerated file name). If you request "json" and wish to access the
JSON data underlying the
TabBookResult, pass in a path for
and you will get a JSON file written there as well.
By specifying a "json"
format, instead of generating an Excel
workbook, you'll get a TabBookResult object, containing nested CrunchCube
results. You can then further format these and construct custom tab reports.