is_regular_grid {tidyterra} | R Documentation |
Check if x and y positions conforms a regular grid
Description
Assess if the coordinates x,y of an object conforms a regular grid. This function is called by its side effects.
This function is internally called by as_spatraster()
.
Usage
is_regular_grid(xy, digits = 6)
Arguments
xy |
A matrix, data frame or tibble of at least two columns representing x and y coordinates. |
digits |
integer to set the precision for detecting whether points are on a regular grid (a low number of digits is a low precision). |
Value
invisible()
if is regular or an error message otherwise
See Also
Other helpers:
compare_spatrasters()
,
is_grouped_spatvector()
,
pull_crs()
Examples
p <- matrix(1:90, nrow = 45, ncol = 2)
is_regular_grid(p)
# Jitter location
set.seed(1234)
jitter <- runif(length(p)) / 10e4
p_jitter <- p + jitter
# Need to adjust digits
is_regular_grid(p_jitter, digits = 4)
[Package tidyterra version 0.6.1 Index]