sample_locations {agricolaeplotr} | R Documentation |
Sample Locations
Description
Returns locations to sample for each plot.
Usage
sample_locations(design, n, plot = TRUE, ...)
Arguments
design |
Your experiment design of plot layouts. |
n |
Number of samples per plot (integer). |
plot |
Logical, indicating whether to visualize the sample locations as a ggplot2-based map. |
... |
further options for 'st_sample' and 'make_polygons' |
Details
This function takes an experiment design (plot layout) and returns random sample locations within each plot. The function uses the 'sf' package to generate spatial polygons for the plots and then samples points within each polygon. Optionally, it can also display the sample locations as a ggplot2-based map.
Value
An 'sf' object containing the sample locations within each plot.
Examples
library(agricolaeplotr)
library(agricolae)
library(ggplot2)
trt <- c('A', 'B', 'C', 'D')
k <- 3
outdesign <- design.bib(trt, k, serie = 2, seed = 41, kinds = 'Super-Duper')
plot_bib(outdesign)
p <- plot_bib(outdesign)
sample_locations(p, 3, TRUE, projection_output = 25832)
[Package agricolaeplotr version 0.5.0 Index]