A pre-generated PurpleAir Timeseries pat object will be loaded containing data for the most recent 7- or 45-day interval. Data are loaded from the archive set with either setArchiveBaseUrl() or setArchiveBaseDir() for locally archived files.

pat_loadLatest(id = NULL, label = NULL, pas = NULL, days = 7)

Arguments

id

PurpleAir sensor 'deviceDeploymentID'.

label

PurpleAir sensor 'label'.

pas

PurpleAir Synoptic pas object.

days

Number of days of data to include (7 or 45).

Value

A PurpleAir Timeseries pat object.

Note

Archive file names are generated with a unique "device-deployment" identifier by combining a unique location ID with a unique device ID. These deviceDeploymentID 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.

Examples

# \donttest{
# Fail gracefully if any resources are not available
try({

library(AirSensor)

setArchiveBaseUrl("https://airsensor.aqmd.gov/PurpleAir/v1")

pas <- pas_load()
pat <- pat_loadLatest(label = "SCSB_07", pas = pas)
pat_multiPlot(pat)

}, silent = FALSE)
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230403.rda
#> ERROR [2023-04-03 16:31:10] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230402.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230401.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230331.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230330.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230329.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230328.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230327.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230326.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230325.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230324.rda
#> ERROR [2023-04-03 16:31:11] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230323.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230322.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230321.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230320.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230319.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230318.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230317.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230316.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230315.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230314.rda
#> ERROR [2023-04-03 16:31:12] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230313.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230312.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230311.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230310.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230309.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230308.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230307.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230306.rda
#> ERROR [2023-04-03 16:31:13] data file could not be loaded from: https://airsensor.aqmd.gov/PurpleAir/v1/pas/2023/pas_20230305.rda
#> Error : Data file could not be loaded after 30 tries
# }