View source: R/mapper-function-helpers.R
| unnest_consistency_cols | R Documentation |
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.
unnest_consistency_cols(results, col_names, index = FALSE, col = "consistency")
results |
Data frame containing a list-column by the name passed to
|
col_names |
String vector of new names for the unnested columns. It
should start with the same string that was given for |
index |
Logical. Should the list-column be indexed into? Default is
|
col |
String (length 1). Name of the list-column within |
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.
Data frame. The column names are determined by col_names.
vignette("consistency-tests-in-depth"), for context.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.