# Function Overview

This document has been updated to reflect functions in AirSensor version 0.6.x.

## Synoptic Data

Purple Air Synoptic (PAS) data provides a view of their sensor network with location metadata and an instantaneous view of measured values. Within the AirSensor package, this data is available as a `pas` object. All functions beginning with `pas_` are designed for creating or working with this data. The following functions are the most common end-user functions:

function | params
--- | ---
Creating a `pas` |
`pas_createNew()` | `countryCodes, includePWFSL, lookbackDays, baseUrl`
Loading a `pas` |
`pas_load()` | `datestamp, retries, timezone, archival`
Obtaining information from a `pas` |
`pas_getColumn()` | `pas, name, pattern, isOutside, isParent`
`pas_getDeviceDeploymentIDs()` | `pas, pattern, isOutside, isParent`
`pas_getIDs()` | `pas, pattern, isOutside, isParent`
`pas_getLabels()` | `pas, pattern, isOutside, isParent`
Manipulating a `pas` |
`pas_filter()` | `pas, ...`
`pas_filterArea()` | `pas, w, e, s, n`
`pas_filterNear()` | `pas, longitude, latitude, radius`
Plotting a `pas` |
`pas_leaflet()` | `pas, parameter, paletteName, ...`
`pas_staticMap()` | `pas, parameter, paletteName, ...`

## Timeseries Data

PurpleAir Timeseries (PAT) data is available on a per-sensor basis. Within the AirSensor package, this data is available as a `pat` object. All functions beginning with `pat_` are designed for creating or working with this data. The following functions are the most common end-user functions:

function | params
--- | ---
Creating a `pat` |
`pat_createNew()` | `id, label, pas, startdate, enddate, timezone, baseUrl`
Loading a `pat` |
`pat_load()` | `id, label, pas, startdate, enddate, days, timezone`
`pat_loadLatest()` | `id, label, pas`
`pat_loadMonth()` | `id, label, pas, datestamp, timezone`
Manipulating a `pat` |
`pat_filter()` | `pat, ...`
`pat_filterDate()` | `pat, startdate, enddate, ...`
`pat_filterDatetime()` | `pat, startdate, enddate, ...`
`pat_join()` | `pat, pat, ...`
`pat_outliers()` | `pat, windowSize, thresholdMin, replace, showPlot, ...`
`pat_qc()` | `pat, ...`
`pat_sample()` | `pat, sampleSize`
Plotting a `pat` |
`pat_dygraph()` | `pat, parameter, sampleSize, ...`
`pat_multiPlot()` | `pat, plottype, sampleSize, ...`
`pat_scatterPlotMatrix()` | `pat, parameters, sampleSize, ...`
State-of-Health functions |
`pat_dailySoH()` | `pat, Soh_functions`
`pat_dailySoHIndex_Plot_00()` | `pat, minPctReporting, breaks`
`pat_dailySoHIndexPlot()` | `pat, minPctReporting, breaks, SoHIndex_FUN`
`pat_dailySoHPlot()` | `pat, ncol`
Other functions |
`pat_aggregate()` | `pat, FUN, ...`
`pat_aggregateOutliserCounts()` | `pat, period, windowSize, thresholdMin`
`pat_externalFit()` | `pat, ...`
`pat_internalFit()` | `pat, ...`
`pat_monitorComparison()` | `pat, ...`

## Hourly Aggregated Data

Hourly Aggregated data can be generated from `pat` objects with the `pat_createAirSensor()` function. Within the AirSensor package, this data is available as an `airsensor` object. All functions beginning with `sensor_` are designed for obtaining or working with this data. The following functions are the most common end-user functions:

function | params
--- | ---
Creating an `airsensor` |
`pat_createAirSensor()` | `pat, parameter, FUN, ...`
Loading an `airsensor` |
`sensor_load()` | `collection, startdate, enddate, days, timezone`
`sensor_loadLatest()` | `collection, days`
`sensor_loadMonth()` | `collection, datestamp, timezone`
`sensor_loadYear()` | `collection, datestamp, timezone`
Manipulating an `airsensor` |
`sensor_filter()` | `sensor, ...`
`sensor_filterMeta()` | `sensor, ...`
`sensor_filterDate()` | `sensor, startdate, enddate, days, ...`
`sensor_filterDate()` | `sensor, startdate, enddate, timezone`
Plotting an `airsensor` |
`sensor_polarPlot()` | `sensor, windData, statistic, ...`
`sensor_pollutionRose()` | `sensor, windData, statistic, ...`
`sensor_calendarPlot()` | `sensor, ...`

Note that each `airsensor` object is also a `ws_monitor` object and can be manipulated and plotted with functions from the PWFSLSmoke package.