api_get_timeseries: Get Timeseries Data from the Postgres Database Via API

Description Usage Arguments

View source: R/api_get_timeseries.R

Description

This function calls postgres_get to get data from the endpoint given by path and calls fhpredict:::flatten_recursive_list to convert the list structure into a data frame. The time columns "createdAt" and "updatedAt" are converted from a text timestamp given in ISO 8601 format (e.g. "2019-10-22T23:38:29.003Z") to POSIXct objects in time zone "Europe/Berlin". A new POSIXct column dateTime is created from the original text columns date and dateTime as they are returned by the API:

Usage

1
2
3
4
5
6
7
api_get_timeseries(
  path,
  subject = "timeseries",
  sort = TRUE,
  token = NULL,
  type = NULL
)

Arguments

path

(relative) path to API endpoint

subject

name of data subject, to be used in messages

sort

if TRUE (the default), the returned data frame will be sorted by the "dateTime" column

token

passed to fhpredict:::postgres_request

type

optional. If given, columns are removed and reordered using fhpredict:::remove_and_reorder_columns()


KWB-R/fhpredict documentation built on Nov. 1, 2020, 5:58 a.m.