PWFSLSmoke (version 1.2.100)

monitor_asDataframe: Return Monitor Data in a Single Dataframe

Description

Creates a dataframe with data from a ws_monitor object, essentially flattening the object. This is especially useful when monitoring data will be shared with non-R users working with spreadsheets. The returned dataframe will contain data from the monitor specified with monitorID.

The number of data columns in the returned dataframe can include all metadata as well as additional calculated values.

By default, the following, core columns are included in the dataframe:

  • utcTime UTC datetime

  • localTime local datetime

  • pm25 PM2.5 values in ug/m3

Any column from ws_monitor$meta may be included in the vector of metaColumns.

The following additional columns of data may be included by adding one of the following to the vector of extraColumns{}

  • aqi hourly AQI values as calculated with monitor_aqi()

  • nowcast hourly Nowcast values as calcualted with monitor_nowcast()

  • dailyAvg daily average PM2.5 values as calculated with monitor_dailyStatistic()

Usage

monitor_asDataframe(ws_monitor, monitorID = NULL, extraColumns = NULL,
  metaColumns = NULL, tlim = NULL)

Arguments

ws_monitor

ws_monitor object

monitorID

monitor ID of interest (not needed if ws_monitor contains only one monitor)

extraColumns

optional vector of additional data columns to generate

metaColumns

optional vector of column names from ws_monitor$meta

tlim

optional vector with start and end times (integer or character representing YYYYMMDD[HH] or POSIXct)

Value

A dataframe version of a ws_monitor object.

See Also

monitor_aqi

monitor_nowcast

monitor_dailyStatistic

Examples

Run this code
# NOT RUN {
wa <- monitor_subset(Northwest_Megafires, stateCodes='WA')
Omak_df <- monitor_asDataframe(wa, monitorID='530470013_01',
                               extraColumns=c('nowcast','dailyAvg'),
                               metaColumns=c('aqsID','siteName','timezone'),
                               tlim=c(20150801,20150901))
# }

Run the code above in your browser using DataCamp Workspace