data: a data object (a data frame or a data.table)
row_names: names of variables for constructing rows
col_names: names of variables for constructing columns independent variables
function_as_character: function to perform for each cell in the pivot table
sigfigs: number of significant digits to which to round values in the pivot table (default = 3)
output: type of output. If output = "dt", the function's output will be a pivot table in a data.table format. If output = "subsets", the function's output will be a list of data tables that are subsets representing each cell in the pivot table. By default, output = "dt"
remove_col_names: logical. Should the column names (i.e., v1, v2, ...) be removed in the data table output?
Returns
the output will be a contingency table in a data.table format