Like dplyr::coalesce(), geo_coalesce() returns the first non-missing element (rowwise). It is useful for replacing empty and missing values with a default.

geo_coalesce(x, ...)

Arguments

x, ...

Vectors that will be recycled to a common length. These don't necessarily need to be geovctrs, but do need methods for geo_is_empty() and must be castable to the type of the first argument.

Value

A vector with the type of the first argument.

Examples

wkt <- wkt(c("POINT (30 10)", "POINT EMPTY", NA)) geo_coalesce(wkt, wkt("POINT (0 0)"))
#> <wk_wkt[3]> #> [1] POINT (30 10) POINT (0 0) POINT (0 0)