Air Quality

To begin, we’ll load foqat and show one dataset in foqat:
aqi is a dataset about time series of air quality with 1-second resolution.

library(foqat)
head(aqi)
#>                  Time        NO     NO2       CO SO2      O3
#> 1 2017-05-01 01:00:00 0.0376578 2.79326 0.256900  NA 56.5088
#> 2 2017-05-01 01:01:00 0.0341483 2.76094 0.254692  NA 57.0546
#> 3 2017-05-01 01:02:00 0.0310285 2.65239 0.265178  NA 57.6654
#> 4 2017-05-01 01:03:00 0.0357016 2.60257 0.269691  NA 58.7863
#> 5 2017-05-01 01:04:00 0.0337507 2.59527 0.273395  NA 59.0342
#> 6 2017-05-01 01:05:00 0.0238120 2.57260 0.276464  NA 59.2240

Calculate daily maximum-8-hour ozone

You can use dm8n() to calculate daily maximum-8-hour ozone.
colid is the column index of date. colio is the column index of ozone. outputMode have two options: value 1 will output 1 list which incudes 1 table (maximum-8-hour ozone); value 2 will output 1 list which contains 4 tables (8-hour ozone, statistics of the number of effective hourly concentrations in each 8-hour average concentration, statistics of the number of effective 8-hour average concentrations in each day, maximum-8-hour ozone). This function will calculate the average values of other species at the same time and plot them.

dm8n_df = dm8n(aqi, colio=6, outputmode = 1)

If you do not want the plot or you want to save time, you can try dm8n_np()

dm8n_df = dm8n_np(aqi, colio=6, outputmode = 1)
#> Joining with `by = join_by(temp_datetime)`
#> [1] "2017-05-01"
#> [1] "2017-05-02"
#> [1] "2017-05-03"
#> [1] "2017-05-04"
#> [1] "2017-05-05"
#> Joining with `by = join_by(date)`
dm8n_df
#>         date       O3       NO2        CO      SO2        NO
#> 1 2017-05-01       NA        NA        NA       NA        NA
#> 2 2017-05-02       NA        NA        NA       NA        NA
#> 3 2017-05-03 54.89782 0.4927718 0.2603227 0.427208 0.2720057
#> 4 2017-05-04 94.59790 1.3747043 0.3623108 3.785070 0.1757755
#> 5 2017-05-05 77.99124 2.3113478 0.2567683 1.712878 0.2380136

Calculate daily maximum-8-hour ozone in batch

dm8n_batch() allows you to calculate daily maximum-8-hour ozone of multiple sites (or cities, or sensors), which means that it will calculate daily maximum-8-hour ozone for all columns except first column (date).