parse_response: Parse the results of a call

Description Usage Arguments Value Examples

View source: R/parse.R

Description

Parse the results of a call

Usage

1
2
3
4
5
6
7
parse_response(
  response,
  format = NULL,
  clean_dates = TRUE,
  rename = TRUE,
  warn_on_initial_parse = FALSE
)

Arguments

response

A response object returned from the API request

format

character string; NULL to use response service type or "csv" or "xml" to force that format

clean_dates

boolean; whether to clean date/time columns

rename

boolean; whether to rename column headings (they are usually blank from the API)

warn_on_initial_parse

logical; should warning messages be shown during the orignal attempt at parsing the response? The default is FALSE as many of the data items need further cleaning and so the warning messages from the original attempt to parse the file are uninformative.

Value

A tibble if format == "csv", otherwise a list

Examples

1
2
3
4
5
list_example <- parse_response(
send_request(
build_call("TEMP", api_key = "12345", from_date = "01 Jun 2019",
to_date = "10 Jun 2019", service_type = "xml")
), "xml")

BMRSr documentation built on June 14, 2021, 5:09 p.m.