/aot-client-r

The Official R Client to the Array of Things API

Primary LanguageR

Array of Things Client

This library serves as the official R client to the Array of Things API.

Using the Library

This isn't listed with CRAN yet (because it's awful -- I'm not an R developer). You can install it from GitHub though:

devtools::install_github("UbranCCD-UChicago/aot-client-r")

There are two general types of functions presented: ls and stat. You should use the ls functions to work with the list endpoints, and stat is for details:

  • ls.projects to get a list of projects
  • ls.nodes to get a list of nodes
  • ls.sensors to get a list of sensors
  • ls.observations to get the observation data
  • ls.raw_observations to get the raw observation data
  • stat.project to get details for a single project
  • stat.node to get details for a single node
  • stat.sensor to get details for a single sensor

The stat functions require a unique id for the type of metadata you're looking for -- slug for projects, vsn for nodes, and path for sensors.

All of the functions allow you to add arbitrary filters/parameters as well:

# sensors onboard node 004
df <- ls.sensors(filters=list(onboard_node="004"))

# note: this doesn't work quite right but it will soon
# average temperature observations made in august per node
df <- ls.observations(filters=list(
  by_sensor="metsense.bmp180.temperature",
  timestamp="ge:2018-08-01T00:00:00",
  timestamp="lt:2018-09-01T00:00:00",
  value="avg:node_vsn"
))