osem_measurements_archive: Fetch day-wise measurements for a single box from the...

osem_measurements_archiveR Documentation

Fetch day-wise measurements for a single box from the openSenseMap archive.

Description

This function is significantly faster than osem_measurements for large time-frames, as daily CSV dumps for each sensor from archive.opensensemap.org are used. Note that the latest data available is from the previous day.

Usage

osem_measurements_archive(x, ...)

## S3 method for class 'sensebox'
osem_measurements_archive(
  x,
  fromDate,
  toDate = fromDate,
  sensorFilter = ~TRUE,
  ...,
  progress = TRUE
)

Arguments

x

A 'sensebox data.frame' of a single box, as retrieved via osem_box, to download measurements for.

...

see parameters below

fromDate

Start date for measurement download, must be convertable via 'as.Date'.

toDate

End date for measurement download (inclusive).

sensorFilter

A NSE formula matching to x$sensors, selecting a subset of sensors.

progress

Whether to print download progress information, defaults to TRUE.

Details

By default, data for all sensors of a box is fetched, but you can select a subset with a dplyr-style NSE filter expression.

The function will warn when no data is available in the selected period, but continue the remaining download.

Value

A tbl_df containing observations of all selected sensors for each time stamp.

Methods (by class)

  • osem_measurements_archive(sensebox): Get daywise measurements for one or more sensors of a single box.

See Also

openSenseMap archive

osem_measurements

osem_box

Examples


  # fetch measurements for a single day
  box = osem_box('593bcd656ccf3b0011791f5a')
  m = osem_measurements_archive(box, as.POSIXlt('2018-09-13'))

  # fetch measurements for a date range and selected sensors
  sensors = ~ phenomenon %in% c('Temperatur', 'Beleuchtungsstärke')
  m = osem_measurements_archive(
    box,
    as.POSIXlt('2018-09-01'), as.POSIXlt('2018-09-30'),
    sensorFilter = sensors
  )


opensensmapr documentation built on March 31, 2023, 11:45 p.m.