sam_field.Rd
Create a sample of a spatial field.
sam_field(x, size, type = "", value, nclusters, ...)
A raster object.
Number of samples to create.
Expected spatial distribution of the samples. Possible values are:
"jittered"
, "random"
, "clustered"
.
Amount of jitter to apply to the samples (in map units; only used when type = "jittered"
)
or radius of the buffer around each cluster (only used when type = "clustered"
).
Number of clusters to simulate. Only used when type = "clustered"
.
Additional arguments passed to terra::spatSample()
.
rast_grid = terra::rast(ncols = 300, nrows = 100, xmin = 0, xmax = 300, ymin = 0, ymax = 100)
sam_field(rast_grid, 100, "jittered", 5)
#> Simple feature collection with 108 features and 0 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 5.355953 ymin: 4.266263 xmax: 295.545 ymax: 95.63973
#> CRS: NA
#> First 10 features:
#> geometry
#> 1 POINT (12.15347 8.74139)
#> 2 POINT (29.84905 9.437398)
#> 3 POINT (45.36387 12.04038)
#> 4 POINT (54.81957 12.11388)
#> 5 POINT (78.94946 5.885855)
#> 6 POINT (93.63162 6.186852)
#> 7 POINT (107.1302 10.70952)
#> 8 POINT (126.4533 10.14613)
#> 9 POINT (145.0731 7.10121)
#> 10 POINT (156.532 9.916109)