Closed turgeonmaxime closed 8 months ago
Since R 4.2.0 these warnings have become error messages (see https://cran.r-project.org/doc/manuals/r-release/NEWS.html, R 4.2.0, SIGNIFICANT USER-VISIBLE CHANGES, number 3).
"Calling if() or while() with a condition of length greater than one gives an error rather than a warning."
Fixed
TLDR: I replaced statements like
class(y) == "Surv"
by the saferinherits(y, "Surv)
. It's safer, because it handles cases whereclass(y)
is a vector of length greater than 1.In a recent update to
R
, they started triggering warnings when the condition in anif
statement has length greater than 1, for example:Created on 2021-02-03 by the reprex package (v1.0.0)
I've seen a few examples of these in
gbm
, but there's one instance in particular that triggers warnings in thecasebase
package, for which I'm a developer:Created on 2021-02-03 by the reprex package (v0.3.0)
(Note: It triggers an error on my machine because I turned on a couple flags that CRAN uses to easily find these warnings.)