View source: R/npi_results_s3.R
npi_flatten.npi_results | R Documentation |
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.
## S3 method for class 'npi_results' npi_flatten(df, cols = NULL, key = "npi")
df |
A data frame containing the results of a call to
|
cols |
If non-NULL, only the named columns specified here will be be
flattened and returned along with |
key |
A quoted column name from |
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.
A data frame (tibble) with flattened list columns.
# Flatten all list columns data(npis) npi_flatten(npis) # Only flatten specified columns npi_flatten(npis, cols = c("basic", "identifiers"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.