| plotsample | R Documentation | 
Creates a plot sample on a regular grid with a random start location.
plotsample(spdf, boundary, x.ppn = 0.25, y.ppn = 0.25, nx = 5, ny = 5)
| spdf | A  | 
| boundary | A  | 
| x.ppn | The proportion of the x=axis that is to be included in the plots. | 
| y.ppn | The proportion of the y=axis that is to be included in the plots. | 
| nx | The number of plots in the x-dimension. | 
| ny | The number of plots in the y-dimension. | 
A list with three components:
plotsA SpatialPolygonsDataFrame object containing the plots
that were sampled.
detsA SpatialPointsDataFrame object containing the locations
of the points within the plots.
countsA dataframe containing the following columns
xThe x-coordinates of the centres of the plots within the boundary.
yThe y-coordinates of the centres of the plots within the boundary.
nThe numbers of points in each plot.
areaThe areas of the plots within the boundary
.
# Some features require the raster package
if (bru_safe_sp() &&
  require("sp") &&
  require("raster", quietly = TRUE) &&
  require("ggplot2", quietly = TRUE) &&
  require("terra", quietly = TRUE) &&
  require("sf", quietly = TRUE)) {
  gorillas <- gorillas_sp()
  plotpts <- plotsample(gorillas$nests, gorillas$boundary,
    x.ppn = 0.4, y.ppn = 0.4, nx = 5, ny = 5
  )
  ggplot() +
    gg(plotpts$plots) +
    gg(plotpts$dets, pch = "+", cex = 2) +
    gg(gorillas$boundary)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.