ris-empty

R Error: could not find function is_empty


I have tried to run an old script (R 3.4?) with R 4.0... but it doesn't work.

is_empty(c(1,1,2,3))
Error in is_empty(c(1, 1, 2, 3)) : 
could not find function is_empty

but ?is_empty still work. Where am I wrong?


Solution

  • To clarify is_empty from the rlang package. It is only used by the purrr package - if you read the documentation of ?purrr::is_empty(), you will see is_empty is among list of objects used by purrr that are "exported from other packages."

    enter image description here

    Here, it clearly tells you it's imported from rlang.

    So no need to install purrr if you dont need/want to - calling either package works:

    purrr::is_empty(NULL)
    # [1] TRUE
    
    rlang::is_empty(NULL)
    # [1] TRUE