databox
: Tools to work with the 'databox' 'API'
The following functions are implemented:
add_metric
: Add a metric to send to databoxclient
: Initialize a databox client and return a databox client object (dco)databox_api_key
: Get or set DATABOX_API_KEY
valuelast_push
: Retrieve the metrics posted in the past pushpush
: Push metrics to databoxThe following data sets are included:
devtools::install_github("hrbrmstr/databox")
options(width=120)
library(databox) library(dplyr) # current verison packageVersion("databox")
We can send one or more metrics to databox. They can be combined in a pipe as well. Once they're "pushed" they are cleared from the client object:
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()
There's a print()
method for dco
objects as well:
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")) %>% print()
Also can validate the last push:
glimpse(last_push())
library(databox) library(testthat) date() test_dir("tests/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.