MathMarEcol / pdyer_aus_bio

GNU General Public License v3.0
0 stars 0 forks source link

Fix check for failed upstream targets #18

Closed PhDyellow closed 1 year ago

PhDyellow commented 1 year ago

Currently the typical check is

any(is.na(__target__$__entry__[[1]]))

This will return true on the following conditions:

  1. The object inside __entry__ has NAs
  2. The object inside __entry__ is a single NA.

I want behaviour 2, not 1.

Possible fixes:

all(is.na(__target__$__entry__[[1]]))

is.na(__target__$__entry__)

The all option is reliable about returning a single bool.

is.na is slightly unreliable about when it applies to just a top level value, and when it drills down into the whole object. A vector, a data.frame and a list of vectors are all vectorised, but a list of data.frames or lists are not vectorised, and the inner list returns false.

Go with all.

I will implement this after I have verified the plotting functions, because the change will trigger a rebuild of the whole pipeline.

PhDyellow commented 1 year ago

Should be resolved by

004473d955122e9fbbb292779579fe0b5d92ec66