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)
#> Simple feature collection with 60 features and 7 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -124.82 ymin: 24.08 xmax: -108.82 ymax: 40.08
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>      R     lon   lat        azi        sd   N       mdr              geometry
#> 1   50 -108.82 24.08 179.958278 13.812793  22 0.4806675 POINT (-108.82 24.08)
#> 2  150 -108.82 26.08   0.197365 11.988758  37 0.8177757 POINT (-108.82 26.08)
#> 3  200 -108.82 30.08  26.287607  7.653565   3 0.6026966 POINT (-108.82 30.08)
#> 4  150 -108.82 32.08  24.081554  8.001669   4 0.6892362 POINT (-108.82 32.08)
#> 5  650 -108.82 34.08  12.153342 21.593028 117 0.8120050 POINT (-108.82 34.08)
#> 6  750 -108.82 36.08  12.986820 21.043816 232 0.8404008 POINT (-108.82 36.08)
#> 7  200 -108.82 38.08 113.388414 17.129106   6 0.7496858 POINT (-108.82 38.08)
#> 8  150 -108.82 40.08 115.231540 12.822209   5 0.7005066 POINT (-108.82 40.08)
#> 9  100 -110.82 24.08 158.848279 10.634489   5 0.7525512 POINT (-110.82 24.08)
#> 10  50 -110.82 26.08 179.644560  7.063926   9 0.5451022 POINT (-110.82 26.08)

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