View source: R/pat_downloadParseRawData.R
pat_downloadParseRawData | R Documentation |
Download and parse time series data for a specific sensor_index
.
pat_downloadParseRawData(
api_key = NULL,
sensor_index = NULL,
startdate = NULL,
enddate = NULL,
timezone = "UTC",
average = 0,
fields = AIRSENSOR_1_PAT_FIELDS,
baseUrl = "https://api.purpleair.com/v1/sensors"
)
api_key |
PurpleAir API Read Key. If |
sensor_index |
PurpleAir sensor unique identifier. |
startdate |
Desired start datetime (ISO 8601). |
enddate |
Desired end datetime (ISO 8601). |
timezone |
Olson timezone used to interpret dates. |
average |
Temporal averaging in minutes performed by PurpleAir. One of: 0 (raw), 10, 30, 60 (hour), 360, 1440 (day). |
fields |
Character string with PurpleAir field names for the Get Sensor Data API. |
baseUrl |
Base URL for the PurpleAir API. |
Dataframe of time series PurpleAir data.
# Fail gracefully if any resources are not available
try({
library(AirSensor)
initializeMazamaSpatialUtils()
pat_raw <-
pat_downloadParseRawData(
api_key = PURPLE_AIR_API_READ_KEY,
sensor_index = "2323",
startdate = "2023-02-01",
enddate = "2023-02-02",
timezone = "UTC"
)
View(pat_raw[1:100,])
}, silent = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.