/AdaptixR

An R interface to the Adaptix platform API

Primary LanguageRGNU General Public License v3.0GPL-3.0

AdaptixR

A package of R functions to interact with the Adaptix platform API by Sensewaves.

Requirements

You will need an Adaptix account to use this R package. To get one, get in touch.

install

Currently only available through this repo.

devtools::install_github("Sensewaves/AdaptixR")

usage

library(AdaptixR)
Connection
conn <- AdaptixConnect(url = "https://alpha.adaptix.io/api", api.key = "your_adaptix_key")
Push data
# Create a stream
my.new.stream <- AdaptixCreateStream(conn = conn, 
				     name = "my_new_stream")
# Create a data frame with some time series data - timestamps must be ISO8601 compliant
points.df <- data.frame(at = ConvertDateToISO8601(c("2017-01-01", "2017-01-02", "2017-01-03", "2017-01-04", "2017-01-05")), 
                        value = c(11.5, 43.0, 15.4, 41.1, 12.2))						 
# Publish the points 	in the stream
AdaptixPublishPoints(conn = conn, stream = my.new.stream$id, points = points.df) 
# [1] "https://alpha.adaptix.io/api/streams/{stream id}/points"
Pull data
AdaptixGetPoints(conn = conn, stream = my.new.stream$id)
#   value         at
# 1   1.0 2017-01-01
# 2   1.1 2017-01-02
# 3   1.2 2017-01-03
Analyze data
# Request a forecast for the next 48h on our stream
forecast.response <- AdaptixForecast(conn = conn, 
				     stream = my.new.stream$id, 
				     span = "48h")
# Parse forecasted scenarios
AdaptixForecastPointsToDataframe(AdaptixGetForecastScenarios(forecast.response))
#       1         at
# 1 43.00 2017-01-05
# 2 28.25 2017-01-06
# 	...