Get interpolated time series data by tag name

tm_ts_interpolated_data(
  token,
  tag_name,
  start_date,
  end_date,
  step = 1,
  type = "linear",
  shift = 0,
  ...
)

Arguments

token

A valid access token

tag_name

Tag name

start_date

POSIXct object with timezone set to "UTC". Start date of the time series

end_date

POSIXct object with timezone set to "UTC". End date of the time series

step

Time increment between returned observations expressed in seconds

type

Interpolation type which is either "linear" or "stepped"

shift

Time series shift (offset) expressed in seconds

...

Additional arguments passed on to the underlying HTTP method. This might be necessary if you need to set some curl options explicitly via config.

Value

A list with two elements:

  • tag: A list with tag information and three elements:

    • tagName: Length one character vector. tag_name of the original request

    • shift: Length one integer vector. shift of the original request

    • interpolationType: Length one character vector. interpolation_type of the original request

  • timeSeries: A data frame with time series data:

    • index: POSIXct vector. Time index of each observation

    • value: Double vector. Value of each observation

Details

The maximum number of points tm_ts_interpolated_data() can return is 10.000. The step argument defines the time increment between returned observations. If you define step to be one second which is the default setting, the time interval you can select using the start and end arguments can span 2 hours, 46 minutes and 40 seconds (2 x 60 x 60 + 46 x 60 + 40 = 10.000) at most. Make sure to decrease the resolution by increasing the step argument if you like to fetch cohesive time series data of a tag which spans more than 10.000 seconds.

The shift argument lets you control if tm_ts_interpolated_data returns values which are either forward or backward shifted in time before they are aligned with the actual time in the response. shift is expressed in seconds. The example in the following table shows the returned time series values based on different shift settings:

Timeshift = 0shift = 1shift = -1
03:02:0023NA27
03:02:01272325
03:02:022527NA

Examples

if (FALSE) { token <- tm_token() start <- ymd_hms("2019-09-15T05:16:00Z") end <- ymd_hms("2019-09-15T06:16:00Z") tm_ts_interpolated_data(token, "BA:CONC.1", start, end, 60) }