pik-piam / magclass

R package | Data Class and Tools for Handling Spatial-Temporal Data
GNU Lesser General Public License v3.0
4 stars 24 forks source link

collapseNames() about to throw random errors some time not too distant in the future #135

Closed 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q closed 1 year ago

0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q commented 1 year ago

https://github.com/pik-piam/magclass/blob/b810bd100f2245fb8786534ebe30ed0bbf3eefc8/R/collapseNames.R#L30

falsely presupposes that dim is of length 1, which collides with _R_CHECK_LENGTH_1_LOGIC2_ now, and will collide with

Calling && or || with LHS or (if evaluated) RHS of length greater than one is now always an error, with a report of the form

'length = 4' in coercion to 'logical(1)'

https://cran.r-project.org/doc/manuals/r-devel/NEWS.html

Maybe consider deprecating it, or turning it into a collapseDim() wrapper, before the next R version hits.

$ reposearch -c "^[^#]*collapseNames" | grep "\.R:[0-9]*$" | awk -F ':' '{ s += $NF } END { print s }'
1666
tscheypidi commented 1 year ago

Thanks, fixed in 1c2376ebb569fe90d761fe19419bb71dc4afdc0c