After upgrading Exploratory to 7.0, if you used NULL in the "If_else" command, it stops working and it fails with `false` must be a vector, not `NULL` error

Problem

After upgrading Exploratory to version 7.0, if you used NULL in if_else command like below for your Create Calculation Step, it stops working after the upgrade.

if_else(str_detect(description, "Exploratory"), amount - tax, NULL, missing = NULL)

You see an error something like the below and does not work. This is because the underlying dplyr R package no longer allows passing NULL to the if_else function. (ref: if_else throws false must be a vector, not NULL. error for dplyr 1.1.0 · Issue #6730 · tidyverse/dplyr · GitHub)

Error in mutate(., without_tax = if_else(str_detect(description, "Exploratory"), : ℹ In argument: `without_tax = if_else(...)`. Caused by error in `if_else()`: ! `false` must be a vector, not `NULL`.

Solution

Change it to pass NA instead of NULL like the below script.

if_else(str_detect(description, "Exploratory"), amount - tax, NA, missing = NA)
1 Like