ODonoghueLab / Minardo-Model

R package for ordering events identified from time series biomolecular data sets
Other
5 stars 1 forks source link

Bug in calcEvents in newer versions of R #15

Open pdcharles opened 7 months ago

pdcharles commented 7 months ago

Hi,

R version 4.2.0+ made a major change to the interpretation of && and || operators, and as of R version 4.3.0 this has moved from warning to error. If either side in the comparison has length > 1 this will result in an error (see https://cran.r-project.org/doc/manuals/r-release/NEWS.html, release 4.3.0, and a relevant stackoverflow post here https://stackoverflow.com/questions/72848442/r-warning-lengthx-2-1-in-coercion-to-logical1)

As of this change, the function calcEvents will always throw an error of the form 'length = xyz' in coercion to 'logical(1)' when called with correctly formed arguments. Since one of either the Tc or centroids argument must be a matrix, the expression ((!is.na(centroids)) || (is.na(centroids) && any(!is.na(Tc)))) evaluated as part of the input check in this function will always result in either is.na(centroids) or is.na(Tc) being greater than length 1, triggering the error on either the || or && comparison.