Skip to contents
  • is_dist_units: Is x a distance unit object?

  • is_diff_dist: What is the difference between x and y distance?

  • is_same_dist: Is x the same distance as y? or does the bbox of x and bbox of y have the same x, y, or diagonal distance?

  • is_shorter, is_longer: Is x shorter or longer than y?

  • is_same_area: do x and y have the same area?

Usage

is_dist_units(x)

is_diff_dist(x, y, units = NULL)

is_same_dist(x, y, dist = NULL, diff = FALSE, ...)

is_longer(x, y)

is_shorter(x, y)

get_dist_units(x, null.ok = TRUE)

as_dist_units(x, units = NULL, null.ok = FALSE)

is_diff_area(x, y, units = NULL, union = TRUE)

is_same_area(x, y, units = NULL, union = TRUE, diff = FALSE, ...)

Arguments

x, y

objects to check

units

For is_diff_dist, if x and y are both not units objects, use units; default to NULL.

dist

type of distance to compare if x and y are sf, sfc, or bbox objects; "diagdist", "xdist", "ydist". defaults to NULL.

diff

If TRUE, return results from is_diff_dist or is_diff_area; if FALSE, return logical indicator; defaults to FALSE

...

Additional parameters passed to all.equal

null.ok

If null.ok is TRUE, allow x to return a NULL value; if FALSE, error on NULL values.

union

If TRUE, union objects before comparing area with is_diff_area() or is_same_area(), defaults to TRUE.

Details

There are two additional functions that support these utility functions:

  • get_dist_units: Get the distance units from x (if x is a sf or units objects or a character string from dist_unit_options)

  • as_dist_units: Convert x to units using units::as_units