pat_createNew: Load latest PurpleAir time series data

Description Usage Arguments Value Note See Also Examples

View source: R/pat_createNew.R

Description

Retrieve and parse timeseries data from the Thingspeak API for specific PurpleAir sensors.

Dates can be anything that is understood by MazamaCoreUtils::parseDatetime() including any of the following recommended formats:

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
pat_createNew(
  id = NULL,
  label = NULL,
  pas = NULL,
  startdate = NULL,
  enddate = NULL,
  timezone = NULL,
  baseUrl = "https://api.thingspeak.com/channels/",
  verbose = FALSE
)

Arguments

id

PurpleAir sensor 'deviceDeploymentID'.

label

PurpleAir sensor 'label'.

pas

PurpleAir Synoptic pas object.

startdate

Desired UTC start time (ISO 8601) or POSIXct.

enddate

Desired UTC end time (ISO 8601) or POSIXct.

timezone

Timezone used to interpret start and end dates.

baseUrl

Base URL for Thingspeak API.

verbose

Logical controlling the generation of warning and error messages.

Value

A PurpleAir Timeseries pat object.

Note

When timezone = NULL, the default, dates are interpreted to be in the local timezone for the sensor of interest.

Starting with AirSensor version 0.6, archive file names are generated with a unique "device-deployment" identifier by combining a unique location ID with a unique device ID. These "device-deployment" identifiers guarantee that movement of a sensor will result in the creation of a new time series.

Users may request a pat object in one of two ways:

1) Pass in id with a valid a deviceDeploymentID

2) Pass in both label and pas so that the deviceDeploymentID can be looked up.

See Also

pat_downloadParseRawData

Examples

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

pat <- pat_createNew(
  label = "Seattle", 
  pas = example_pas, 
  startdate = 20180701, 
  enddate = 20180901
)
pat_multiPlot(pat)

AirSensor documentation built on March 13, 2021, 1:07 a.m.