tm_ts_interpolated_data: Get interpolated time series data by tag name

Description Usage Arguments Details Value Examples

View source: R/interpolated_data.R

Description

Get interpolated time series data by tag name

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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.

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:

Time shift = 0 shift = 1 shift = -1
03:02:00 23 NA 27
03:02:01 27 23 25
03:02:02 25 27 NA

Value

A list with two elements:

Examples

1
2
3
4
5
6
7
8
## Not run: 
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)

## End(Not run)

TrendMiner/trendminer documentation built on Jan. 30, 2020, 12:21 a.m.