You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
future:::tweakFutureAssignmentCall(): Warning message: In if (n != 3) return(expr) : the condition has length > 1 and only the first element will be used
#395
@HenrikBengtsson, if you want to handle this specific case in future, it comes from future:::tweakFutureAssignmentCall() making the perfectly reasonable assumption that length() returns something of length 1. I imagine that you will have to handle the possibility that length() could return something that isn't size one in more than just this one specific function for it to be a bulletproof fix, which might not be worth it.
fi<-Formula::Formula(Sepal.Length~Sepal.Width)
# Comes from here...gp<-future::getGlobalsAndPackages(fi)
#> Warning in if (n != 3) return(expr): the condition has length > 1 and only the#> first element will be used# Which calls this:globals:::findGlobals(fi, tweak=future:::tweakExpression)
#> Warning in if (n != 3) return(expr): the condition has length > 1 and only the#> first element will be used#> [1] "~" "Sepal.Length" "Sepal.Width"# tweakExpression() uses tweakFutureAssignmentCall() which makes the# perfectly reasonable assumption that `length(expr)` returns# something of length 1future:::tweakFutureAssignmentCall(fi)
#> Warning in if (n != 3) return(expr): the condition has length > 1 and only the#> first element will be used#> Sepal.Length ~ Sepal.Width
Hmm... yeah, that's not what you'd expect from length() but maybe there is a way to avoid the assumption that length() returns something else than a numeric/integer scalar.
The text was updated successfully, but these errors were encountered:
Package authors have written methods that return a result of length other than one (Formula) and that return a vector of type double (Matrix), even with non-integer values (earlier versions of sets). Where a single double value is returned that can be represented as an integer it is returned as a length-one integer vector.
Fixed in the develop branch. The other "tweak" functions had similar issues - I think the only safe, generic solution is to look at length(unclass(expr)), so I went with that. Thxs again.
From DavisVaughan/furrr#115 (comment):
This is because:
Hmm... yeah, that's not what you'd expect from
length()
but maybe there is a way to avoid the assumption thatlength()
returns something else than a numeric/integer scalar.The text was updated successfully, but these errors were encountered: