General utility functions

General utility functions

Usage

compact(.x)

a %||% b

check_dots_named(dots, call = rlang::caller_env())

Arguments

.x

a list

a

an R object

b

an R object

dots

a list collected from dots via rlang::list2(...)

call

default rlang::caller_env(). The caller environment passed to cli::cli_abort()

Value

  • compact() a list

  • %||% the first non-null item or NULL if both are NULL

Details

  • compact() removes any NULL list elements

  • %||% is a special pipe operator that returns b if a is NULL

Examples


# remove null elements
compact(list(a = NULL, b = 1))
#> $b
#> [1] 1
#> 

# if NULL return rhs
NULL %||% 123
#> [1] 123

# if not NULL return lhs
123 %||% NULL
#> [1] 123

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close