monitor_asDataframe: Return Monitor Data in a Single Dataframe

Description Usage Arguments Value Note See Also Examples

View source: R/monitor_asDataframe.R

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:

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{}

Usage

1
2
3
4
5
6
7
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.

Note

The tlim argument is interpreted as localtime, not UTC.

See Also

monitor_aqi

monitor_nowcast

monitor_dailyStatistic

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(PWFSLSmoke)

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))

dplyr::glimpse(Omak_df)

PWFSLSmoke documentation built on Nov. 23, 2021, 5:06 p.m.