Within a consistency test mapper function, it may become
necessary to unpack a column resulting from a basic *_scalar() testing
function. That will be the case if a show_* argument of the mapper
function like show_rec in grim_map() is TRUE, and the *_scalar()
function returns a list of values, not just a single value.
At the point where such as list is stored in a data frame column (most
likely "consistency"), call unnest_consistency_cols() to unnest the
results into multiple columns.
Arguments
- results
Data frame containing a list-column by the name passed to
col.- col_names
String vector of new names for the unnested columns. It should start with the same string that was given for
col.- index
Logical. Should the list-column be indexed into? Default is
FALSE.- col
String (length 1). Name of the list-column within
resultsto operate on. Default is"consistency".
Details
This function is a custom workaround in place of
tidyr::unnest_wider(), mirroring some of the latter's functionality. It
was created because unnest_wider() can be too slow for use as a helper
function.
See also
vignette("consistency-tests-in-depth"), for context.