osem_boxes: Get a set of senseBoxes from the openSenseMap

Description Usage Arguments Value See Also Examples

Description

Boxes can be selected by a set of filters. Note that some filters do not work together:

  1. phenomenon can only be applied together with date or from / to

  2. date and from / to cannot be specified together

Usage

1
2
3
osem_boxes(exposure = NA, model = NA, grouptag = NA, date = NA,
  from = NA, to = NA, phenomenon = NA, endpoint = osem_endpoint(),
  progress = TRUE, cache = NA)

Arguments

exposure

Only return boxes with the given exposure ('indoor', 'outdoor', 'mobile')

model

Only return boxes with the given model

grouptag

Only return boxes with the given grouptag

date

Only return boxes that were measuring within <c2><b1>4 hours of the given time

from

Only return boxes that were measuring later than this time

to

Only return boxes that were measuring earlier than this time

phenomenon

Only return boxes that measured the given phenomenon in the time interval as specified through date or from / to

endpoint

The URL of the openSenseMap API instance

progress

Whether to print download progress information, defaults to TRUE

cache

Whether to cache the result, defaults to false. If a valid path to a directory is given, the response will be cached there. Subsequent identical requests will return the cached data instead.

Value

A sensebox data.frame containing a box in each row

See Also

openSenseMap API documentation (web)

osem_phenomena

osem_box

osem_clear_cache

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  # get *all* boxes available on the API
  b = osem_boxes()

  # get all boxes with grouptag 'ifgi' that are placed outdoors
  b = osem_boxes(grouptag = 'ifgi', exposure = 'outdoor')

  # get all boxes with model 'luftdaten_sds011_dht22'
  b = osem_boxes(grouptag = 'ifgi')

  # get all boxes that have measured PM2.5 in the last 4 hours
  b = osem_boxes(date = Sys.time(), phenomenon = 'PM2.5')

  # get all boxes that have measured PM2.5 between Jan & Feb 2018
  library(lubridate)
  b = osem_boxes(
    from = date('2018-01-01'),
    to = date('2018-02-01'),
    phenomenon = 'PM2.5'
  )

  # get all boxes from a custom (selfhosted) openSenseMap API
  b = osem_box(endpoint = 'http://api.my-custom-osem.com')

  # get all boxes and cache the response, in order to provide
  # reproducible results in the future. Also useful for development
  # to avoid repeated loading times!
  b = osem_boxes(cache = getwd())
  b = osem_boxes(cache = getwd())

  # get *all* boxes available on the API, without showing download progress
  b = osem_boxes(progress = FALSE)

opensensmapr documentation built on May 2, 2019, 2:58 p.m.