3/3/23, 19:19 NOMAS NOMAS ARMANDO 2023-03-02 library(ggplot2) library(stats) library(base) library(dplR) ## This is dplR version 1.7.4. ## dplR is part of openDendro https://opendendro.org. ## New users can visit https://opendendro.github.io/dplR-workshop/ to get started. library(dplyr) ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union library(hexbin) library(lattice) library(latticeExtra) ## ## Attaching package: 'latticeExtra' ## The following object is masked from 'package:ggplot2': ## ## layer library(utils) library(maps) library(tools) library(utf8) library(lubridate) file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 1/17 3/3/23, 19:19 NOMAS ## ## Attaching package: 'lubridate' ## The following objects are masked from 'package:base': ## ## date, intersect, setdiff, union library(latexpdf) library(openair) #update.packages(ask = FALSE, checkBuilt = TRUE, include = FALSE) #tinytex::tlmgr_update() #tinytex::reinstall_tinytex(force = TRUE) mydata <- read.csv("mydata.csv") dim(mydata) ## [1] 263040 11 print(mydata[1:2,1]) ## [1] "01/01/2020 00:00" "01/01/2020 01:00" mydata$date <- as.POSIXct(mydata$date, format = "%d/%m/%Y %H:%M", tz = "UTC") print(mydata[1:2,1]) ## [1] "2020-01-01 00:00:00 UTC" "2020-01-01 01:00:00 UTC" # sapply(mydata, class) mydata$WD <- as.numeric(mydata$WD) ## Warning: NAs introduced by coercion mydata$PM10 <- as.numeric(mydata$PM10) ## Warning: NAs introduced by coercion sapply(mydata, class) file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 2/17 3/3/23, 19:19 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## NOMAS $date [1] "POSIXct" "POSIXt" $WS [1] "numeric" $WD [1] "numeric" $CO [1] "numeric" $NO2 [1] "numeric" $O3 [1] "numeric" $PM10 [1] "numeric" $PM2.5 [1] "numeric" $SO2 [1] "numeric" $NOX [1] "numeric" $NO [1] "numeric" dim(mydata) ## [1] 263040 11 summary(mydata) file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 3/17 3/3/23, 19:19 ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## NOMAS date Min. :2019-01-01 1st Qu.:2019-10-01 Median :2020-07-01 Mean :2020-07-01 3rd Qu.:2021-04-01 Max. :2021-12-31 CO Min. :0.00 1st Qu.:0.38 Median :0.57 Mean :0.72 3rd Qu.:0.86 Max. :8.87 NA's :88186 PM2.5 Min. : 0.00 1st Qu.: 10.60 Median : 18.70 Mean : 25.45 3rd Qu.: 31.73 Max. :395.80 NA's :207004 00:00:00.00 23:45:00.00 23:30:00.00 23:29:33.39 23:15:00.00 23:00:00.00 NO2 Min. :0.00 1st Qu.:0.01 Median :0.01 Mean :0.02 3rd Qu.:0.02 Max. :0.52 NA's :116797 SO2 Min. :0.00 1st Qu.:0.00 Median :0.00 Mean :0.00 3rd Qu.:0.00 Max. :0.03 NA's :87770 WS Min. : 0.00 1st Qu.: 1.30 Median : 2.53 Mean : 3.00 3rd Qu.: 4.20 Max. :67.30 NA's :62601 O3 Min. :0.00 1st Qu.:0.01 Median :0.02 Mean :0.03 3rd Qu.:0.04 Max. :0.22 NA's :60053 NOX Min. :0.00 1st Qu.:0.01 Median :0.02 Mean :0.03 3rd Qu.:0.03 Max. :0.63 NA's :116829 WD Min. : 0.0 1st Qu.:119.1 Median :191.1 Mean :183.3 3rd Qu.:250.1 Max. :344.5 NA's :78182 PM10 Min. : 0.00 1st Qu.: 21.70 Median : 36.14 Mean : 48.18 3rd Qu.: 58.84 Max. :698.34 NA's :116652 NO Min. :0.00 1st Qu.:0.00 Median :0.00 Mean :0.01 3rd Qu.:0.01 Max. :0.35 NA's :114914 head(mydata) date WS <dttm> <dbl> WD <dbl> CO <dbl> NO2 <dbl> O3 PM… <dbl> <dbl> PM2.5 <dbl> SO2 <dbl> 1 2020-01-01 00:00:00 0.58 140.56 1.040 0.013 0.011 NA NA 9e-04 2 2020-01-01 01:00:00 1.10 236.26 NA NA 0.008 NA NA 1e-03 3 2020-01-01 02:00:00 0.53 205.57 1.125 0.017 0.005 NA NA 9e-04 4 2020-01-01 03:00:00 2.78 250.71 0.885 0.009 0.011 NA NA 4e-04 5 2020-01-01 04:00:00 3.42 130.75 0.801 0.005 0.012 NA NA 2e-04 6 2020-01-01 05:00:00 3.45 68.26 0.691 0.004 0.012 NA NA 4e-04 date WS WD CO N… O3 PM10 <dttm> <dbl> <dbl> <dbl><dbl> <dbl> <dbl> PM2.5 <dbl> SO2 <dbl> 6 rows | 1-10 of 12 columns tail(mydata) 263035 2021-12-31 18:00:00 6.0 233.1 NA NA 0.027 24.5 13.6 6e-04 263036 2021-12-31 19:00:00 5.5 226.6 NA NA 0.023 21.5 19.9 5e-04 file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 4/17 3/3/23, 19:19 NOMAS date WS WD CO N… O3 PM10 <dttm> <dbl> <dbl> <dbl><dbl> <dbl> <dbl> PM2.5 <dbl> SO2 <dbl> 263037 2021-12-31 20:00:00 3.8 224.4 NA NA 0.023 31.8 25.0 5e-04 263038 2021-12-31 21:00:00 4.0 241.0 NA NA 0.024 29.4 25.6 7e-04 263039 2021-12-31 22:00:00 4.1 239.6 NA NA 0.020 32.6 28.1 9e-04 263040 2021-12-31 23:00:00 6.2 239.7 NA NA 0.025 25.8 25.5 6e-04 6 rows | 1-10 of 12 columns summaryPlot(mydata, percentile = 0.95) polarPlot(mydata, pollutant = "CO", x = "WS", wd = "WD", main = "CO") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 5/17 3/3/23, 19:19 NOMAS ## Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in ## dplyr 1.1.0. ## ℹ Please use `reframe()` instead. ## ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()` ## always returns an ungrouped data frame and adjust accordingly. ## ℹ The deprecated feature was likely used in the openair package. ## Please report the issue at <]8;;https://github.com/davidcarslaw/openair/issueshttps://git hub.com/davidcarslaw/openair/issues]8;;>. polarPlot(mydata, pollutant = "NO", x = "WS", wd = "WD", main = "NO") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 6/17 3/3/23, 19:19 NOMAS polarPlot(mydata, pollutant = "NO2", x = "WS", wd = "WD", main = "NO2") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 7/17 3/3/23, 19:19 NOMAS polarPlot(mydata, pollutant = "NOX", x = "WS", wd = "WD", main = "NOX") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 8/17 3/3/23, 19:19 NOMAS polarPlot(mydata, pollutant = "O3", x = "WS", wd = "WD", main = "O3") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 9/17 3/3/23, 19:19 NOMAS polarPlot(mydata, pollutant = "SO2", x = "WS", wd = "WD", main = "SO2") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 10/17 3/3/23, 19:19 NOMAS polarPlot(mydata, pollutant = "PM10", x = "WS", wd = "WD", main = "PM10") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 11/17 3/3/23, 19:19 NOMAS polarPlot(mydata, pollutant = "PM2.5", x = "WS", wd = "WD", main = "PM2.5") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 12/17 3/3/23, 19:19 NOMAS pairs(mydata[sample(1:nrow(mydata),500),c(4,5,6,8,9,10)], lower.panel = panel.smooth, upper.panel = NULL, col= "skyblue3") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 13/17 3/3/23, 19:19 NOMAS #windRose(mydata) windRose(mydata, ws = "WS", wd = "WD") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 14/17 3/3/23, 19:19 NOMAS windRose(mydata, ws = "WS", wd = "WD", type = "season") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 15/17 3/3/23, 19:19 NOMAS calendarPlot(mydata,pollutant = "CO", year = 2020, annotate = "value", cols=c("white","yello w","orange","red","black","blue"), limits = c(0, 2), lim = 100, col.lim = c("black","white"), fo nt.lim = c(1,2), digits = 2, cex.lim = c(0.8,1.2), main = "EVOLUCIÓN DE CO EN 2020") file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 16/17 3/3/23, 19:19 NOMAS file:///G:/Mi unidad/Projects_programming/R/Armando/CONTAMINACION_ATMOSFERA4.html 17/17