DOI-USGS / dataRetrieval

This R package is designed to obtain USGS or EPA water quality sample data, streamflow data, and metadata directly from web services.
https://doi-usgs.github.io/dataRetrieval/
Other
259 stars 84 forks source link

whatWQPdata fails when no sites exist #544

Closed jordansread closed 3 years ago

jordansread commented 3 years ago

Describe the bug This is kind of a cryptic error, so I wasn't sure what was going on originally. But if I specify a whatWQPdata that doesn't return any sites, I get a

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
  arguments imply differing number of rows: 1, 0

To Reproduce Steps to reproduce the behavior:

library(dataRetrieval)
dataRetrieval::whatWQPdata(characteristicName = "Salinity", bBox = '-102.5,27.5,-100,30',  minresults = 100)

Expected behavior Given I don't know a priori this is empty, I'd either expect an empty tibble/data.frame or a more intuitive error

Screenshots Within the code, the doc that comes back has an empty feature set:

{"type":"FeatureCollection","features":[]}

Session Info Please include your session info:

R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] scipiper_0.0.22

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5          rstudioapi_0.11     xml2_1.3.2          magrittr_1.5        units_0.6-7         hms_0.5.3           progress_1.2.2     
 [8] tidyselect_1.1.0    R6_2.4.1            rlang_0.4.8         httr_1.4.2          storr_1.2.1         dplyr_1.0.2         tools_3.6.3        
[15] grid_3.6.3          KernSmooth_2.23-17  e1071_1.7-3         DBI_1.1.0           class_7.3-17        ellipsis_0.3.1      dataRetrieval_2.7.6
[22] yaml_2.2.1          digest_0.6.27       tibble_3.0.3        lifecycle_0.2.0     crayon_1.3.4        sf_0.9-6            purrr_0.3.4        
[29] tidyr_1.1.2         vctrs_0.3.4         curl_4.3            glue_1.4.2          remake_0.3.0        compiler_3.6.3      pillar_1.4.6       
[36] generics_0.0.2      prettyunits_1.1.1   classInt_0.4-3      jsonlite_1.7.1      pkgconfig_2.0.3