bcgov / envair

BC ENV Air Quality Monitoring Data
Apache License 2.0
6 stars 4 forks source link

importBC_data() throwing error about parameter=aqhi #22

Closed DonnaHaga closed 11 months ago

DonnaHaga commented 1 year ago

When trying to import data for many parameters (but not for the aqhi) for the year 2022, get an error as follows:

parameters <- tolower(
  c(
    "CO",
    "H2S",
    "HF",
    "HUMIDITY",
    "NO",
    "NO2",
    "NOX",
    "O3",
    "PM10",
    "PM25",
    "SO2",
    "TEMP_MEAN",
    "TRS",
    "WDIR_VECT",
    "WSPD_SCLR"
  )
)

data<-envair::importBC_data(
  parameter_or_station = parameters,
  years=2022,
  use_openairformat = FALSE
) %>%
  dplyr::distinct(.) %>%
  dplyr::filter(lubridate::year(DATE_PST) == 2022)
Error in if (tolower(parameter_or_station) == "aqhi") { : 
  the condition has length > 1

R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.utf8  LC_CTYPE=English_Canada.utf8    LC_MONETARY=English_Canada.utf8
[4] LC_NUMERIC=C                    LC_TIME=English_Canada.utf8    

time zone: America/Edmonton
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] janitor_2.2.0    arrow_13.0.0.1   envair_0.4.0.100 magrittr_2.0.3   lubridate_1.9.3  forcats_1.0.0   
 [7] stringr_1.5.0    dplyr_1.1.3      purrr_1.0.2      readr_2.1.4      tidyr_1.3.0      tibble_3.2.1    
[13] ggplot2_3.4.3    tidyverse_2.0.0 

loaded via a namespace (and not attached):
 [1] gtable_0.3.4        xfun_0.40           htmlwidgets_1.6.2   latticeExtra_0.6-30 lattice_0.21-8     
 [6] tzdb_0.4.0          bitops_1.0-7        vctrs_0.6.4         tools_4.3.1         generics_0.1.3     
[11] curl_5.1.0          fansi_1.0.5         cluster_2.1.4       pkgconfig_2.0.3     Matrix_1.6-1       
[16] data.table_1.14.8   checkmate_2.2.0     openair_2.17-0      RColorBrewer_1.1-3  assertthat_0.2.1   
[21] readxl_1.4.3        lifecycle_1.0.3     compiler_4.3.1      deldir_1.0-9        munsell_0.5.0      
[26] mapproj_1.2.11      snakecase_0.11.1    htmltools_0.5.6     maps_3.4.1          RCurl_1.98-1.12    
[31] yaml_2.3.7          htmlTable_2.4.1     Formula_1.2-5       hexbin_1.28.3       pillar_1.9.0       
[36] MASS_7.3-60         DT_0.29             Hmisc_5.1-1         rpart_4.1.19        nlme_3.1-163       
[41] tidyselect_1.2.0    digest_0.6.33       stringi_1.7.12      bookdown_0.35       splines_4.3.1      
[46] fastmap_1.1.1       grid_4.3.1          colorspace_2.1-0    cli_3.6.1           base64enc_0.1-3    
[51] utf8_1.2.3          withr_2.5.1         foreign_0.8-85      scales_1.2.1        backports_1.4.1    
[56] bit64_4.0.5         timechange_0.2.0    rmarkdown_2.24      jpeg_0.1-10         bit_4.0.5          
[61] interp_1.1-4        nnet_7.3-19         gridExtra_2.3       cellranger_1.1.0    png_0.1-8          
[66] hms_1.1.3           evaluate_0.21       knitr_1.44          mgcv_1.9-0          rlang_1.1.1        
[71] Rcpp_1.0.11         glue_1.6.2          rstudioapi_0.15.0   jsonlite_1.8.7      R6_2.5.1    
jeromerobles commented 11 months ago

does not seem to show up in envair 0.4.0.300. `parameters <- tolower( c( "CO", "H2S", "HF", "HUMIDITY", "NO", "NO2", "NOX", "O3", "PM10", "PM25", "SO2", "TEMP_MEAN", "TRS", "WDIR_VECT", "WSPD_SCLR" ) )

data<-importBC_data( parameter_or_station = parameters, years=2022, use_openairformat = FALSE ) %>% dplyr::distinct(.) %>% dplyr::filter(lubridate::year(DATE_PST) == 2022)

nrow(data) `

DonnaHaga commented 11 months ago

agreed! resolved with 0.4.0.300:)