quadrats | R Documentation |
Creates quadrat polygons for sampling or analysis
quadrats(x, s = 250, n = 100, r = NULL, sp = FALSE)
x |
An sf POLYGONS object defining extent |
s |
Radius defining single or range of sizes of quadrats |
n |
Number of quadrats |
r |
A rotation factor for random rotation, default is NULL |
sp |
(FALSE | TRUE) Output sp class object |
The radius (s) parameter can be a single value or a range of values, representing a randomization range of resulting quadrat sizes. The rotation (r) parameter can also be used to defined a fixed rotation or random range of quadrat rotations. You can specify each of these parameters using an explicit vector that will be sampled eg., seq(100,300,0.5)
an sf POLYGONS object with rotated polygon(s)
Jeffrey S. Evans <jeffrey_evans@tnc.org>
library(sf)
library(terra)
# read meuse data and create convex hull
if (require(sp, quietly = TRUE)) {
data(meuse, package = "sp")
meuse <- st_as_sf(meuse, coords = c("x", "y"), crs = 28992, agr = "constant")
e <- st_convex_hull(st_union(meuse))
# Fixed size 250 and no rotation
s <- quadrats(e, s = 250, n = 10)
plot(st_geometry(s))
# Variable sizes 100-300 and rotation of 0-45 degrees
s <- quadrats(e, s = c(100,300), n = 10, r = c(0,45))
plot(st_geometry(s))
# Variable sizes 100-300 and no rotation
s <- quadrats(e, s = c(100,300), n = 10)
plot(st_geometry(s))
} else {
cat("Please install sp package to run example", "\n")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.