extract_norman_fields: Extract Specific Fields from Nested Norman List

View source: R/extract_norman_fields.R

extract_norman_fieldsR Documentation

Extract Specific Fields from Nested Norman List

Description

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").

Usage

extract_norman_fields(data_list, field_names)

Arguments

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")).

Value

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.

Examples

## Not run: 
  fields <- c("id", "Name", "City", "Value", "Unit")
  df <- extract_norman_fields(data_cas_1$Data, fields)
  print(df)

## End(Not run)


normanR documentation built on Sept. 12, 2026, 5:10 p.m.