-
Notifications
You must be signed in to change notification settings - Fork 3
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
Error in predict function #12
Comments
That's very strange. I have tried their package on different computers and the error occurs on all of them. The incorrect line for me is the following: call.f<-as.formula(paste("tmp~",paste(call.f,sep="")[[3]])) The error is: Where call.f is the model formula. Does the following work for them: call.f <- as.formula(y8hrmax ~ xmaxtemp + xwdsp + xrh) call.f<-as.formula(paste("tmp~",paste(call.f,sep="")[[3]])) After all, this line does nothing but replace "y8hrmax" with "tmp". And just this causes me the error no matter which computer I test it on... Do you have an additional package installed or something? |
Thank you. But the file spGPP.r is not within bmstdr package. It belongs to spTimer. Please contact the spTimer maintainer. Please see below the code and the output I produced without error on my Windows computer. Restarting R session...
spTimer version: 3.3.1
Output: GPP approximation modelsSampled: 400 of 2000, 20.00%.
|
I have found the solution or the error. Your tip with the string - package has helped me very well. I have taken out all times one after the other and so I could identify the package which causes the error. It was the package "formula.tools" which overwrites the base paste() function. If I take out this package and restart r then the prediction works without error. Here again the code:
Great, then one error would be already done :=) Thanks for the help. Because of the other things I write to the maintrainer. |
The predict function has error with bmstdr. The error is:
"Error in paste(call.f, sep = "")[[3]] : subscript out of bounds"
Here a Example:
A temporary fix is:
mod$fit$call <- c(mod$fit$call,"", str_split_fixed(mod$fit$call, " ", n = 3)[3])
The error is that the predict function cannot divide the regression formula by dependent and independent variables. I do this manually with the fix. The error line (line number 674) is in the data spGPP.r from the package spTimer in github with the Web Adress https://github.com/cran/spTimer/blob/master/R/spGPP.r in the function "spGPP.prediction". The line is call.f<-as.formula(paste("tmp~",paste(call.f,sep="")[[3]])).
It is very important that you fix this in the program code, because this error occurs in all models. My temporary fix is only a stopgap.
`Sujit said:
Thanks for this. But sorry, I have not been able to reproduce the error. I checked both on my linux and Windows machines. I will ask some of my students to double check this. Please can you give me code which results in error.`
My system:
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 17763)
Version bmstdr: 0.2.2
The text was updated successfully, but these errors were encountered: