Cerate a pat object for a specific sensor_index.
pat_createNew(
api_key = NULL,
pas = NULL,
sensor_index = NULL,
startdate = NULL,
enddate = NULL,
timezone = "UTC",
average = 0,
baseUrl = "https://api.purpleair.com/v1/sensors",
verbose = FALSE
)PurpleAir API Read Key. If api_key = NULL, it
will be obtained using getAPIKey("PurpleAir-read").
See MazamaCoreUtils::setAPIKey.
Previously generated pas object containing sensor_index.
PurpleAir sensor unique identifier.
Desired start time (ISO 8601) or POSIXct.
Desired end time (ISO 8601) or POSIXct.
Olson timezone used to interpret dates.
Temporal averaging in minutes performed by PurpleAir. One of: 0 (raw), 10, 30, 60 (hour), 360, 1440 (day).
Base URL for the PurpleAir API.
Logical controlling the generation of warning and error messages.
A PurpleAir Timeseries pat object.
# \donttest{
# Fail gracefully if any resources are not available
try({
library(AirSensor)
pat <-
pat_createNew(
api_key = PURPLE_AIR_API_READ_KEY,
pas = example_pas,
sensor_index = "3515",
startdate = "2022-07-01",
enddate = "2022-07-08",
timezone = "UTC",
verbose = TRUE
)
View(pat$meta[1:100,])
}, silent = FALSE)
#> Error in pat_createNew(api_key = PURPLE_AIR_API_READ_KEY, pas = example_pas, :
#> object 'PURPLE_AIR_API_READ_KEY' not found
# }