timeBlend: Time Blend.

Description Usage Arguments Value See Also Examples

View source: R/timeBlend.R

Description

Get Dataframe with DataToBlend ordered time by sending a list or Series of Anchor timestamps. Consult documentation here.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
timeBlend(
  token,
  anchor_ts,
  blend_source,
  blend_type = "closest_observation",
  direction = "time_prior",
  interval_output = "count",
  ts_restriction = NULL,
  oblender = FALSE,
  interval_size = 3600,
  consumption_confirmation = "off",
  missing_values = "raw",
  data_format = "dataframe"
)

Arguments

token

Obtained in openblender.io

anchor_ts

Array of Unix timestamp values to blend data to.

blend_source

JSON object of Data To Blend configuration obtained from a data source in OpenBlender.io

blend_type

Type of blend to gather data: 'closest_observation', 'agg_in_intervals', (Default: closest_observation).

direction

(Only if blend_type = 'agg_in_intervals'). Select chronological direction of observation or interval to aggregate from 'blend source' to 'anchor': 'time_prior': Gather data from blend source prior or at the same time as each observation from anchor. 'time_prior_strict': Gather data from blend source strictly prior to each observation from anchor. 'time_post': Gather data subsequent to or at the same time than each observation from anchor. 'time_post_strict': Gather data strictly subsequent to each observation from anchor. 'time_prior_and_post': Gather data prior and subsequent to each observation from anchor. Default (time_prior)

interval_output

(Only if blend_type = 'agg_in_range'), options: 'count' (any type of feature). 'sum' 'avg' (for numerical features). 'text', 'text_list' (for text features). (Default = count)

ts_restriction

None

oblender

Omit this parameter

interval_size

(Only if blend_type = 'agg_in_intervals'). Time interval size in seconds to be used with the selected agg_interval_order.

consumption_confirmation

"on" or "off", default "on"

missing_values

Treatment of missing values. 'raw': Ignore missing values (return NaN). 'impute': Impute missing values. (Default 'raw')

data_format

Default "Dataframe"

Value

A Blended dataset intersected with your anchor in time, success/error message when you insert observations or the list of observations requested.

See Also

To see more details go to openblender.io

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
#Blend a dataset
#You provide df_anchor data
blend_source <- list(
id_dataset="5f063dda198b5854284dae58",
feature="price",
dataset_filter=c(list(low=list("$gt"=300)))
)

df_blend <- openblender::timeBlend(token = "YOUR_TOKEN",
                                  anchor_ts = df_anchor$timestamp,
                                  blend_type = "agg_in_intervals",
                                  direction = "time_prior",
                                  interval_output = "avg",
                                  interval_size = 60 * 60 * 24 * 1,
                                  blend_source = blend_source,
                                  missing_values = "impute")

## End(Not run)

openblender documentation built on Dec. 1, 2020, 3:01 a.m.