diegovalle / aire.zmvm

@@ -202,6 +202,7 @@
Loading
202 202
  for (i in seq_len(length(pollutant)))
203 203
    if (!(identical("O3", pollutant[i]) || identical("NO2", pollutant[i]) ||
204 204
          identical("SO2", pollutant[i]) || identical("CO", pollutant[i]) ||
205 +
          identical("PM25", pollutant[i]) ||
205 206
          identical("PM10", pollutant[i]) || identical("TC", pollutant[i])))
206 207
      stop("Invalid pollutant value", call. = FALSE)
207 208
  pollutant <- unique(pollutant)
@@ -253,6 +254,8 @@
Loading
253 254
    df$value <- as.numeric(df$value)
254 255
    df$date <- as.Date(df$date)
255 256
    df$unit <- "IMECA"
257 +
    names(df)
258 +
    df$pollutant <- .recode_pollutant(df$pollutant)
256 259
    if (criterion != tolower("HORARIOS")) {
257 260
      as.data.frame(df[, c("date", "zone", "pollutant", "unit", "value")])
258 261
    } else {

@@ -59,7 +59,8 @@
Loading
59 59
         "wdr" = "WDR",
60 60
         "tmp" = "TMP",
61 61
         "rh" = "RH",
62 -
         "PM2.5" = "PM25")
62 +
         "PM2.5" = "PM25",
63 +
         "PM2" = "PM25")
63 64
}
64 65
65 66
#' Recode numeric codes to concentration units (extended)

@@ -97,7 +97,7 @@
Loading
97 97
    mxc$unit <- "IMECA"
98 98
    mxc <- mxc[, c("station_code", "municipio", "quality", "pollutant",
99 99
                   "unit", "value", "datetime")]
100 -
100 +
    mxc$pollutant <- .recode_pollutant(mxc$pollutant)
101 101
    return(mxc[!is.na(mxc$station_code), ])
102 102
  },
103 103
  error = function(cond) {

@@ -21,6 +21,7 @@
Loading
21 21
#'  \item{"NO2"}{ - Nitrogen Dioxide}
22 22
#'  \item{"O3"}{ - Ozone}
23 23
#'  \item{"PM10"}{ - Particulate matter 10 micrometers or less}
24 +
#'  \item{"PM25"}{ - Particulate matter 2.5 micrometers or less}
24 25
#' }
25 26
#' @param date The date for which to download data in YYYY-MM-DD format
26 27
#' (the earliest possible date is 2009-01-01).
@@ -61,9 +62,9 @@
Loading
61 62
    stop("date should be a date in YYYY-MM-DD format", call. = FALSE)
62 63
  if (date < "2009-01-01")
63 64
    stop("date should be after 2009-01-01", call. = FALSE)
64 -
  if (!(identical("O3", pollutant) || identical("NO2", pollutant) |
65 -
      identical("SO2", pollutant) || identical("CO", pollutant) |
66 -
      identical("PM10", pollutant)))
65 +
  if (!(identical("O3", pollutant) || identical("NO2", pollutant) ||
66 +
      identical("SO2", pollutant) || identical("CO", pollutant) ||
67 +
      identical("PM10", pollutant) || identical("PM25", pollutant) ))
67 68
     stop("Invalid pollutant value", call. = FALSE)
68 69
69 70
  if (date >= "2017-01-01" && show_messages)
@@ -79,7 +80,8 @@
Loading
79 80
                         "NO2" = 1,
80 81
                         "SO2" = 2,
81 82
                         "CO" = 3,
82 -
                         "PM10" = 4),
83 +
                         "PM10" = 4,
84 +
                         "PM25" = 5),
83 85
    aceptar     = "Submit",
84 86
    consulta    = 1
85 87
  )
@@ -109,11 +111,12 @@
Loading
109 111
  df$date <- date
110 112
  names(df)[1] <- "hour"
111 113
  ## There's an empty row at the end of the data
112 -
  df <- df[3:(nrow(df)-1), ]
114 +
  df <- df[3:(nrow(df) - 1), ]
113 115
  df <- gather(df, station_code, value, -date, -hour)
114 116
  df[which(df$value == ""), "value"] <- NA
115 117
  df$value <- as.numeric(as.character(df$value))
116 118
  df$pollutant <- pollutant2
119 +
  df$pollutant <- .recode_pollutant(df$pollutant)
117 120
  df$unit <- "IMECA"
118 121
  df[, c("date", "hour", "station_code", "pollutant", "unit", "value" )]
119 122
}
Files Coverage
R 84.47%
Project Totals (10 files) 84.47%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading