add_metric: Add a metric to send to databox

Description Usage Arguments Value References Examples

View source: R/databox.r

Description

Add a metric to send to databox

Usage

1
add_metric(dco, key, value, date = NULL, unit = NULL, mattrs = NULL)

Arguments

dco

databaox client object created by client() or piped/passed from other add_metric() calls

key

name of metric (without leading $)

value

value of metric (must be numeric)

date

(optional) Date or POSIXct object which will be converted to the proper databox API format. NOTE: this auto-converts to UTC for the API

unit

(optional) units description for the metric (e.g. USD)

mattrs

(optiona) named vector of attribute key/value pairs to add to the metric

Value

dco updated with metrics values

References

https://developers.databox.com/api/

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
databox::client() %>%
  add_metric("sales", 83000, Sys.Date()) %>%
  add_metric("sales", 4000, unit="USD") %>%
  add_metric("expenses", 87500) %>%
  add_metric("sales", 123000, mattrs=c("channel"="in-person", "cheese"="manchego")) %>%
  push()

## End(Not run)

hrbrmstr/databox documentation built on May 16, 2017, 1:15 a.m.