General utility functions for working with distance units objects
Source:R/is_dist_units.R
is_dist_units.Rd
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
, orbbox
objects; "diagdist", "xdist", "ydist". defaults toNULL
.- diff
If
TRUE
, return results from is_diff_dist or is_diff_area; ifFALSE
, return logical indicator; defaults toFALSE
- ...
Additional parameters passed to all.equal
- null.ok
If null.ok is
TRUE
, allow x to return aNULL
value; ifFALSE
, error onNULL
values.- union
If
TRUE
, union objects before comparing area withis_diff_area()
oris_same_area()
, defaults toTRUE
.
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
See also
Other dist:
convert_dist_scale()
,
convert_dist_units()
,
get_measurements
,
sf_bbox_misc