A function to flatten nested server results from an api_operations into a single non-nested data frame

result_flatten(x, encoding = "UTF-8")

Arguments

x

an `httr` response() object

encoding

HTTP charset parameter to use (default is "UTF-8")

Value

a data frame

Examples

flattened_results <- result_flatten(
   api_concepts(term = "pneumonia",
   activeFilter = TRUE,
   limit = 10))
str(flattened_results)
#> 'data.frame':	10 obs. of  16 variables:
#>  $ conceptId       : chr  "233604007" "161525004" "416916004" "300999006" ...
#>  $ active          : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
#>  $ definitionStatus: chr  "FULLY_DEFINED" "FULLY_DEFINED" "PRIMITIVE" "FULLY_DEFINED" ...
#>  $ moduleId        : chr  "900000000000207008" "900000000000207008" "900000000000207008" "900000000000207008" ...
#>  $ effectiveTime   : chr  "20150131" "20040731" "20050731" "20160731" ...
#>  $ id              : chr  "233604007" "161525004" "416916004" "300999006" ...
#>  $ idAndFsnTerm    : chr  "233604007 | Pneumonia (disorder) |" "161525004 | History of pneumonia (situation) |" "416916004 | Lipoid pneumonitis (disorder) |" "300999006 | Basal pneumonia (disorder) |" ...
#>  $ fsn.term        : chr  "Pneumonia (disorder)" "History of pneumonia (situation)" "Lipoid pneumonitis (disorder)" "Basal pneumonia (disorder)" ...
#>  $ fsn.lang        : chr  "en" "en" "en" "en" ...
#>  $ pt.term         : chr  "Pneumonia" "H/O: pneumonia" "Lipoid pneumonitis" "Basal pneumonia" ...
#>  $ pt.lang         : chr  "en" "en" "en" "en" ...
#>  $ total           : int  614 614 614 614 614 614 614 614 614 614
#>  $ limit           : int  10 10 10 10 10 10 10 10 10 10
#>  $ offset          : int  0 0 0 0 0 0 0 0 0 0
#>  $ searchAfter     : chr  "WzIzMzYxMzAwOV0=" "WzIzMzYxMzAwOV0=" "WzIzMzYxMzAwOV0=" "WzIzMzYxMzAwOV0=" ...
#>  $ searchAfterArray: int  233613009 233613009 233613009 233613009 233613009 233613009 233613009 233613009 233613009 233613009