normalise_obj: Normalise a JSON-list.

View source: R/request.R

normalise_objR Documentation

Normalise a JSON-list.

Description

This function normalises a JSON-list. The concept of JSON-list is here defined as an ordinary R list object whose elements are either all named or none is named. These lists map naturally to JSON elements: objects and arrays. What this function does is wrap certain elements of the nested list obj in list() to make the tree structure of the obj list homologous across different responses. This makes all responses of the same entity type (studies, associations, variants or traits) homologous and hence joinable with family functions lst_*_join.

Usage

normalise_obj(obj, resource_url)

Arguments

obj

A JSON-list. This is just an ordinary list as returned by gc_request or gc_request_all.

resource_url

The URL endpoint used to obtain the JSON-list obj. This is used to infer the type of GWAS entity returned. See object_type_from_url for more details.

Details

This normalisation is GWAS object type specific. The parameter resource_url should be mappable to either studies, associations, variants or traits by object_type_from_url.

Value

A normalised JSON-list.


ramiromagno/gwasrapidd documentation built on Jan. 3, 2024, 10:21 p.m.