Skip to contents

Filter smoothed stress field containing a range of search radii or kernel half widths to find shortest wavelength (R) with the least circular sd. or dispersion (or any statistic) for each coordinate, respectively.

Usage

compact_grid(x, type = c("stress", "dispersion"))

compact_grid2(x, ..., FUN = min)

Arguments

x

output of stress2grid(), PoR_stress2grid(), stress2grid_stats(), or kernel_dispersion()

type

character. Type of the grid x. Either "stress" (when input is stress2grid() or PoR_stress2grid()) or "dispersion" (when input is kernel_dispersion()).

...

<tidy-select> One unquoted expression separated by commas. Variable names can be used as if they were positions in the data frame. Variable must be a column in x.

FUN

function is used to aggregate the data using the search radius R. Default is min().

Value

sf object

Examples

data("san_andreas")
res <- stress2grid(san_andreas)
compact_grid(res) |> head()
#> Simple feature collection with 6 features and 7 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -108.82 ymin: 24.08 xmax: -108.82 ymax: 36.08
#> Geodetic CRS:  WGS 84
#>     R     lon   lat         azi        sd  N       mdr              geometry
#> 1  50 -108.82 24.08   1.8057901 13.722146 22 0.4806675 POINT (-108.82 24.08)
#> 2 150 -108.82 26.08   0.2652812 11.655853 37 0.8177757 POINT (-108.82 26.08)
#> 3 200 -108.82 30.08  24.9634540 10.493094  3 0.6026966 POINT (-108.82 30.08)
#> 4 150 -108.82 32.08  22.0400646  8.455832  4 0.6892362 POINT (-108.82 32.08)
#> 5 100 -108.82 34.08  35.3150489 18.021098  6 0.5770263 POINT (-108.82 34.08)
#> 6 150 -108.82 36.08 143.7086285 32.137765  3 0.7654557 POINT (-108.82 36.08)

if (FALSE) { # \dontrun{
res2 <- stress2grid_stats(san_andreas)
compact_grid2(res2, var, FUN = min)
} # }