Closed adamkski closed 4 years ago
At first glance, this seemed like a cryptic bug I would need a reprex for. But the only occurrence of "if (is.na(x)) {" is here:
https://github.com/ropensci/drake/blob/a12283917fdce1f706c88bff80e55d9bcf70eaf9/R/utils.R#L295
Changing is.na()
to anyNA()
should be safer without much loss in speed.
library(microbenchmark)
microbenchmark(
a = anyNA("x"),
b = is.na("x")
)
#> Unit: nanoseconds
#> expr min lq mean median uq max neval
#> a 52 58 105.37 65.0 68 4010 100
#> b 66 71 99.09 78.5 83 1913 100
system.time(replicate(1e5, anyNA(sample.int(1e5, 1))))
#> user system elapsed
#> 0.283 0.011 0.294
system.time(replicate(1e5, is.na(sample.int(1e5, 1))))
#> user system elapsed
#> 0.286 0.000 0.286
Created on 2019-12-09 by the reprex package (v0.3.0)
I will make the change. If it solves the problem, please let me know. If not, please post a traceback()
. A reprex
is the best thing, but probably difficult in your situation.
Prework
drake
's code of conduct.drake-r-package
tag. (If you anticipate extended follow-up and discussion, you are already in the right place!)Description
When I run
vis_drake_graph()
ormake()
, I get the error:Error in if (is.na(x)) { : argument is of length zero
. Please note downgrading to drake 7.8.0 resolves the issue. This only happens with the latest dev version.Reproducible example
This is not straightforward because the code is sensitive to my organization. I have tried to replicate the issue without success - although I did accidentally replicate another issue #1086!
I will try again soon.
Desired result
Typical behaviour for
vis_drake_graph()
andmake()
Session info