chrisvwn / Rnightlights

R package to extract data from satellite nightlights.
GNU General Public License v3.0
47 stars 14 forks source link

Receiving Error in seq.int(0, to0 - from, by) : 'to' must be a finite number #8

Closed giacfalk closed 6 years ago

giacfalk commented 6 years ago

When I run the following (found in the Wiki)

`highestAdmLevelStats <- getCtryNlData(ctryCode = ctry, 
                                      admLevel = "highest",
                                      nlType = "VIIRS.M", 
                                      nlPeriods = nlRange("201401", "201412"), 
                                      nlStats = "sum",
                                      ignoreMissing=FALSE)

I get the following error message

Error in seq.int(0, to0 - from, by) : 'to' must be a finite number

chrisvwn commented 6 years ago

Hi @giacfalk,

Please post the output from sessioninfo()

giacfalk commented 6 years ago

I receive a 'Error in sessioninfo() : could not find function "sessioninfo"'. Note that I have installed and loaded the following packages:

install.packages("Rnightlights”)
install.packages("lubridate")
install.packages("reshape2")
install.packages("ggplot2")
install.packages("plotly")

library(Rnightlights)
library(lubridate)
library(reshape2)
chrisvwn commented 6 years ago

Sorry about that. I mistyped. It should be sessionInfo() capital I.

The packages should have installed okay but sometimes an out-of-date package or a partially installed/corrupt package can cause problems.

Also try re-running install.packages("Rnightlights") which should ideally install all the other packages automatically. You shouldn't need to install the other packages separately.

Finally, there is a bug that I have fixed with using the admLevel="highest". You can check out the updated package by installing from github before it appears on CRAN by running:

install.packages("devtools")
devtools::install_github("chrisvwn/Rnightlights")
giacfalk commented 6 years ago

Thanks, anyway, I keep getting the same error. Here is my sessionInfo() output:

`R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Italian_Italy.1252  LC_CTYPE=Italian_Italy.1252   
[3] LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C                  
[5] LC_TIME=Italian_Italy.1252    

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

other attached packages:
[1] Rnightlights_0.2.1 lubridate_1.7.4    reshape2_1.4.3    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16      magrittr_1.5      devtools_1.13.5   maptools_0.9-2   
 [5] maps_3.3.0        lattice_0.20-35   R6_2.2.2          cleangeo_0.2-2   
 [9] foreach_1.4.4     pbapply_1.3-4     httr_1.3.1        stringr_1.3.1    
[13] plyr_1.8.4        fields_9.6        tools_3.4.4       dotCall64_0.9-5.2
[17] parallel_3.4.4    rgdal_1.2-20      grid_3.4.4        data.table_1.11.2
[21] spam_2.1-4        git2r_0.21.0      withr_2.1.2       rgeos_0.3-26     
[25] iterators_1.0.9   digest_0.6.15     settings_0.2.4    codetools_0.2-15 
[29] curl_3.2          memoise_1.1.0     sp_1.2-7          rworldmap_1.3-6  
[33] stringi_1.1.7     compiler_3.4.4    foreign_0.8-69  `
giacfalk commented 6 years ago

I have just solved typing Sys.setlocale("LC_TIME", "English"). Apparently, LC_TIME being set to Italian_Italy.1252 was causing the issue!

chrisvwn commented 6 years ago

Great! I am glad you found a solution for this! Will come in handy for anyone else who encounters this issue. Thanks for posting your solution.

rhamoonga commented 3 years ago

Hello everyone, i have zero coding experience. i have tried to break down the following call buti cant seem to pin point the issue causing the error:

epinow_res <- epinow( reported_cases = cases, generation_time = generation_time, delays = delay_opts(incubation_period), return_output = TRUE, verbose = TRUE, horizon = 21, stan = stan_opts(samples = 750, chains = 4) )

The error am getting is:

Logging threshold set at INFO for the EpiNow2 logger Writing EpiNow2 logs to the console and: C:\Users\HPLAPT~1\AppData\Local\Temp\RtmpA7ocdD/regional-epinow/2015-04-30.log Logging threshold set at INFO for the EpiNow2.epinow logger Writing EpiNow2.epinow logs to the console and: C:\Users\HPLAPT~1\AppData\Local\Temp\RtmpA7ocdD/epinow/2015-04-30.log Error in seq.int(0, to0 - from, by) : 'to' must be a finite number

Kindly assist.

the session info is:

R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages: [1] distcrete_1.0.3 epitrix_0.2.2 incidence2_1.1
[4] projections_0.5.4 EpiEstim_2.2-4 EpiNow2_1.3.2
[7] epicontacts_1.1.0 forcats_0.5.1 stringr_1.4.0
[10] dplyr_1.0.6 purrr_0.3.4 readr_1.4.0
[13] tidyr_1.1.3 tibble_3.1.2 ggplot2_3.3.3
[16] tidyverse_1.3.1 here_1.0.1 rio_0.5.26

loaded via a namespace (and not attached): [1] colorspace_2.0-1 ellipsis_0.3.2 rprojroot_2.0.2
[4] futile.logger_1.4.3 fs_1.5.0 rstudioapi_0.13
[7] listenv_0.8.0 rstan_2.21.2 MatrixModels_0.5-0
[10] fansi_0.5.0 lubridate_1.7.10 xml2_1.3.2
[13] codetools_0.2-16 splines_4.0.3 R.methodsS3_1.8.1
[16] jsonlite_1.7.2 mcmc_0.9-7 broom_0.7.6
[19] dbplyr_2.1.1 R.oo_1.24.0 compiler_4.0.3
[22] httr_1.4.2 backports_1.2.1 assertthat_0.2.1
[25] Matrix_1.2-18 cli_2.5.0 formatR_1.11
[28] quantreg_5.86 prettyunits_1.1.1 tools_4.0.3
[31] igraph_1.2.6 coda_0.19-4 gtable_0.3.0
[34] glue_1.4.2 reshape2_1.4.4 V8_3.4.2
[37] Rcpp_1.0.6 cellranger_1.1.0 vctrs_0.3.8
[40] conquer_1.0.2 progressr_0.8.0 globals_0.14.0
[43] ps_1.6.0 openxlsx_4.2.3 rvest_1.0.0
[46] lifecycle_1.0.0 pacman_0.5.1 future_1.21.0
[49] MASS_7.3-53 scales_1.1.1 hms_1.1.0
[52] coarseDataTools_0.6-5 parallel_4.0.3 inline_0.3.19
[55] SparseM_1.81 lambda.r_1.2.4 curl_4.3.1
[58] gridExtra_2.3 loo_2.4.1 StanHeaders_2.21.0-7 [61] incidence_1.7.3 stringi_1.5.3 pkgbuild_1.2.0
[64] zip_2.2.0 truncnorm_1.0-8 rlang_0.4.11
[67] pkgconfig_2.0.3 matrixStats_0.59.0 lattice_0.20-41
[70] patchwork_1.1.1 cowplot_1.1.1 processx_3.5.2
[73] tidyselect_1.1.1 parallelly_1.26.0 plyr_1.8.6
[76] magrittr_2.0.1 R6_2.5.0 generics_0.1.0
[79] DBI_1.1.1 pillar_1.6.1 haven_2.4.1
[82] foreign_0.8-80 withr_2.4.2 fitdistrplus_1.1-5
[85] survival_3.2-7 future.apply_1.7.0 modelr_0.1.8
[88] crayon_1.4.1 futile.options_1.0.1 utf8_1.2.1
[91] runner_0.4.0 grid_4.0.3 readxl_1.3.1
[94] data.table_1.14.0 callr_3.7.0 reprex_2.0.0
[97] digest_0.6.27 MCMCpack_1.5-0 R.utils_2.10.1
[100] RcppParallel_5.1.4 stats4_4.0.3 munsell_0.5.0

chrisvwn commented 3 years ago

Hi @rhamoonga ,

This seems to be related to the EpiNow2 package. You can try to ask for assistance on their github page: https://github.com/epiforecasts/EpiNow2/issues

rhamoonga commented 3 years ago

Thank you @chrisvwn , i will revert with feedback