This function takes an npi_results S3 object returned by
npi_search and flattens its list columns. It unnests the
lists columns and left joins them by npi. You can optionally specify
which columns from df to include.
A data frame (tibble) with flattened list columns.
Arguments
df
A data frame containing the results of a call to
npi_search.
cols
If non-NULL, only the named columns specified here will be be
flattened and returned along with npi.
key
A quoted column name from df to use as a matching key. The
default value is "npi".
Details
The names of unnested columns are prefixed by the name of their
originating list column to avoid name clashes and show their lineage. List
columns containing all NULL data will be absent from the result because there
are no columns to unnest.