outbreak-info / R-outbreak-info

R package to access the genomics and epidemiology data and Research Library metadata compiled and standardized on outbreak.info.
https://outbreak-info.github.io/R-outbreak-info/
MIT License
20 stars 10 forks source link

`getAdmn2ByState` fails with any state name #91

Closed watronfire closed 2 years ago

watronfire commented 2 years ago

I'm trying to get daily cases and deaths for all counties in California, and it seems like the function getAdmn2ByState should do what I want. However the functions fails with the following error if the state name is correct.

After reinstalling the package from the main branch here are the inputs I've tried:

> library( outbreakinfo )
Warning message:
replacing previous import ‘jsonlite::flatten’ by ‘purrr::flatten’ when loading ‘outbreakinfo’
> getAdmn2ByState( "California" )
Error in pb_tick(self, private, len, tokens) : !self$finished is not TRUE
> getAdmn2ByState( c( "California" ) )
Error in pb_tick(self, private, len, tokens) : !self$finished is not TRUE
> getAdmn2ByState( searchLocations( "California", admin_level = 1) )
Error in pb_tick(self, private, len, tokens) : !self$finished is not TRUE
> getAdmn2ByState( "New Mexico" )
Error in pb_tick(self, private, len, tokens) : !self$finished is not TRUE
> getAdmn2ByState( c( "New Mexico" ) )
Error in pb_tick(self, private, len, tokens) : !self$finished is not TRUE
> getAdmn2ByState( searchLocations( "New Mexico", admin_level = 1) )
Error in pb_tick(self, private, len, tokens) : !self$finished is not TRUE

Here is the output of my sessionInfo() if it helps:

R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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] outbreakinfo_0.2.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3       pillar_1.7.0       compiler_4.0.2     tools_4.0.2
 [5] class_7.3-17       prettyunits_1.1.1  progress_1.2.2     jsonlite_1.8.0
 [9] lifecycle_1.0.1    tibble_3.1.6       gtable_0.3.0       pkgconfig_2.0.3
[13] rlang_1.0.2        DBI_1.1.3          cli_3.2.0          curl_4.3.2
[17] yaml_2.3.5         e1071_1.7-9        stringr_1.4.0      dplyr_1.0.8
[21] httr_1.4.3         generics_0.1.3     vctrs_0.4.0        hms_1.1.1
[25] classInt_0.4-3     grid_4.0.2         tidyselect_1.1.2   glue_1.6.2
[29] sf_1.0-7           R6_2.5.1           fansi_1.0.3        tidyr_1.2.0
[33] ggplot2_3.3.6      purrr_0.3.4        magrittr_2.0.3     units_0.8-0
[37] scales_1.2.0       ellipsis_0.3.2     assertthat_0.2.1   colorspace_2.0-3
[41] KernSmooth_2.23-17 utf8_1.2.2         stringi_1.7.6      proxy_0.4-26
[45] munsell_0.5.0      RcppSimdJson_0.1.7 crayon_1.5.1
gkarthik commented 2 years ago

Hey Nate,

I tested the function on R 4.0.2 macOS Catalina but I was unable to replicate the error. The download takes about 1 min. Is the progress bar not showing up for you at all?

> df <- getAdmn2ByState("California")
  downloading [==============================] 100% eta:  0s
> nrow(df)
[1] 51625
watronfire commented 2 years ago

No download bar, just that error after a few seconds.

malkuzweny commented 2 years ago

Hi Nate, could you try uninstalling the progress package, and then doing a fresh install of outbreakinfo? Since it looks like the error is coming from that package. I was also unable to reproduce the error.

watronfire commented 2 years ago

Hi Manar,

The error still remains after uninstalling progress and reinstalling outbreakinfo. But I do believe that it is line 103 of getEpiData.R that's causing the issue. I was able to rewrite the getEpiData function without the progress bar functionality, and that returned the data.frame as expected.

Please let me know if I should close the issue, as I have the functionality I need.