View source: R/util_extract_multibuffer.R
util_extract_multibuffer | R Documentation |
This function creates a series of circular buffers around spatial points and computes
the frequency of each value of a raster within the buffers; the results are printed in
a data.frame
.
util_extract_multibuffer( landscape, points, buffer_width, max_width = NULL, rel_freq = FALSE, fun = NULL, point_id_text = TRUE, ... )
landscape |
|
points |
Point(s) represented by a two-column matrix or |
buffer_width |
Buffer widths in which the frequency of landscape values is measured.
It might be either a single value or a vector of buffer sizes, if |
max_width |
Maximum distance to which buffer_width is summed up. If |
rel_freq |
Logical. If |
fun |
Function to apply to raster values within the buffer (e.g. "median", "mean"). |
point_id_text |
Logical. If |
... |
additional arguments (none implemented) |
A tibble with the frequency of each raster value within the buffers of different sizes
around each point. Alternatively, a tibble with the relative frequency of raster values, if rel_freq = TRUE
,
or a function from the raster values, if fun
is provided.
# create single point new_point = matrix(c(75,75), ncol = 2) # show landscape and point of interest show_landscape(classified_landscape, discrete = TRUE) + ggplot2::geom_point(data = data.frame(x = new_point[,1], y = new_point[,2]), ggplot2::aes(x = x, y = y), col = "grey", size = 3) # extract frequency of each pixel value within each buffer from 10 to 50 m width util_extract_multibuffer(classified_landscape, new_point, 10, 50) # use irregular buffer sizes util_extract_multibuffer(classified_landscape, new_point, c(5, 10, 20, 30)) # also returns relative frequency util_extract_multibuffer(classified_landscape, new_point, 10, 50, rel_freq = TRUE) # use a given function - e.g. median in each buffer width util_extract_multibuffer(classified_landscape, new_point, 10, 50, fun = "median") # show multiple points share new_points = matrix(c(75, 110, 75, 30), ncol = 2) util_extract_multibuffer(classified_landscape, new_points, c(5, 10, 20, 30))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.