Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing value when TRUE/FALSE is neccesary #18

Open
JVAQUEROM opened this issue Dec 12, 2022 · 3 comments
Open

Missing value when TRUE/FALSE is neccesary #18

JVAQUEROM opened this issue Dec 12, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@JVAQUEROM
Copy link

Describe the bug
When running MK.TempAggr function, I get this error:

Error in if (result$P <= c(1 - alpha.mk/100)) { : 
  missing value where TRUE/FALSE needed

To Reproduce
I cannot share the data that outputs this error, but I tried two timeseries and in one the issue is solved setting a proper value of resolution (which, by the way, is not clear to me how to set it).

Expected behavior
The function not failing

Desktop (please complete the following information):

  • OS: openSuSE Linux 15.4
  • mannkendall version 1.1.0
  • R version: 4.2.2

Additional context
The dataset is deseasonalized monthly data from original daily. The daily data seems to error due to RAM consumption being too high.

@JVAQUEROM JVAQUEROM added the bug Something isn't working label Dec 12, 2022
@JVAQUEROM
Copy link
Author

Trying to do a reproducible example gave a different error

> date = seq.Date(from=as.Date("2010-01-01"), to=as.Date("2020-12-31"), by="1 day")
> xx = rnorm(n=length(date))
> df <- data.frame(date=as.POSIXct(date), xx=xx)
> library(MannKendallTrends)
> MK.tempAggr(df, resolution=1)
Prewithening the timeseries...
Error in if (result$P <= c(1 - alpha.mk/100)) { : 
  the condition has length > 1
Also: Warning message:
In nanprewhite.AR(data = data, alpha.ak = alpha.ak) :
  no s.s. autocorrelation

I also add my sessionInfo()

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-suse-linux-gnu (64-bit)
Running under: openSUSE Leap 15.4

Matrix products: default
BLAS:   /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=es_ES.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=es_ES.UTF-8        LC_COLLATE=es_ES.UTF-8    
 [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=es_ES.UTF-8   
 [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] MannKendallTrends_1.1.0 nvimcom_0.9-115        

loaded via a namespace (and not attached):
 [1] knitr_1.39        magrittr_2.0.3    R.cache_0.15.0    rlang_1.0.6      
 [5] fastmap_1.1.0     fansi_1.0.3       styler_1.7.0      tools_4.2.2      
 [9] xfun_0.30         R.oo_1.24.0       utf8_1.2.2        cli_3.4.1        
[13] withr_2.5.0       htmltools_0.5.2   digest_0.6.27     tibble_3.1.8     
[17] lifecycle_1.0.3   purrr_0.3.5       vctrs_0.5.1       R.utils_2.11.0   
[21] fs_1.5.2          glue_1.6.2        evaluate_0.15     rmarkdown_2.14   
[25] reprex_2.0.2      compiler_4.2.2    pillar_1.8.1      R.methodsS3_1.8.1
[29] pkgconfig_2.0.3  

@JVAQUEROM
Copy link
Author

JVAQUEROM commented Dec 13, 2022

Sorry for posting again.

The python package seemed to work with the same data so I guess it is a bug in the R data. Checking the source files I found several times a line like this

        ## Prob.MK.n <- read.table('prob_mk_n.csv', sep=",", header = FALSE)

Always commented. So maybe this Prob.MK.n is never read and is a NULL?

EDIT: I see it is loaded with the package. However, it has a lot of NA values. This can be the cause of the error.

@dw-hydro
Copy link

I am having the same error and am asking if anyone has any follow-up? I tried adjusting resolution up/down to fix the error but that did not solve it for my dataset. I would be happy to share my dataset if anyone would like to see what can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants