hzambran / hydroPSO

Model-Independent Particle Swarm Optimisation for Environmental Models
https://cran.r-project.org/package=hydroPSO
GNU General Public License v2.0
36 stars 18 forks source link

Passing matrix of initial conditions gives warnings in R 4.x #20

Open cameronbracken opened 4 years ago

cameronbracken commented 4 years ago

In R 4.x "array" was added to the class of matrix objects in addition to the "matrix" class. The checks in the hydroPSO function for vector vs matrix/data.frame throw warnings in R 4.x.

https://github.com/tidymodels/recipes/issues/422 https://cran.r-project.org/doc/manuals/r-release/NEWS.html

hzambran commented 3 years ago

Dear @https://github.com/cameronbracken,

Can you confirm that those warnings were solved in hydroPSO 0.5-1?

cameronbracken commented 3 years ago

The warnings are still occurring for me in 0.5-1. I believe they are from the following lines:

https://github.com/hzambran/hydroPSO/blob/e6f17140c0864f65b7519ebfcdbe32684525a9c3/R/PSO_v2013.R#L2115 https://github.com/hzambran/hydroPSO/blob/e6f17140c0864f65b7519ebfcdbe32684525a9c3/R/PSO_v2013.R#L2117

For matrix objects, class(par) has two elements, which is causing the warning.