powered by
General utility functions
compact(.x)a %||% bcheck_dots_named(dots, call = rlang::caller_env())data_frame(x, call = rlang::caller_call())
a %||% b
check_dots_named(dots, call = rlang::caller_env())
data_frame(x, call = rlang::caller_call())
compact() a list
compact()
%||% the first non-null item or NULL if both are NULL
%||%
NULL
a list
an R object
a list collected from dots via rlang::list2(...)
rlang::list2(...)
default rlang::caller_call().
rlang::caller_call()
a data.frame
compact() removes any NULL list elements
%||% is a special pipe operator that returns b if a is NULL
b
a
# remove null elements compact(list(a = NULL, b = 1)) # if NULL return rhs NULL %||% 123 # if not NULL return lhs 123 %||% NULL
Run the code above in your browser using DataLab