View source: R/extract_norman_fields.R
| extract_norman_fields | R Documentation |
This function iterates through a list of nested data (e.g., from the Norman API) and extracts values for specific field names provided by the user. It uses a recursive search to find the fields, meaning the user does not need to know the full path (e.g., just "City" instead of "Data source$Organisation$City").
extract_norman_fields(data_list, field_names)
data_list |
A list of lists (the standard output from JSON parsing). |
field_names |
A character vector of field names to extract (e.g., c("E-mail", "City")). |
A data.frame where columns are the requested fields and rows correspond to the items in the input list. Missing values are filled with NA.
## Not run:
fields <- c("id", "Name", "City", "Value", "Unit")
df <- extract_norman_fields(data_cas_1$Data, fields)
print(df)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.