| compact | R Documentation | 
General utility functions
compact(.x)
a %||% b
check_dots_named(dots, call = rlang::caller_env())
.x | 
 a list  | 
a | 
 an R object  | 
b | 
 an R object  | 
dots | 
 a list collected from dots via   | 
call | 
 default   | 
compact() removes any NULL list elements
%||% is a special pipe operator that returns b if a is NULL
compact() a list
%||% the first non-null item or NULL if both are NULL
# remove null elements
compact(list(a = NULL, b = 1))
# if NULL return rhs
NULL %||% 123
# if not NULL return lhs
123 %||% NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.