is_inside_plg | R Documentation |
This function determines whether a given point lies inside a polygon defined by its vertices.
is_inside_plg(point, polygon_df, strictly = TRUE)
point |
A numeric vector with two elements representing the x (first value) and y (second value) coordinates of the point. |
polygon_df |
A data frame with columns 'x' and 'y', containing the vertices of the polygon. |
strictly |
Logical, indicating whether the point must strictly lie inside the polygon (TRUE) or might be part of the polygon boundary (FALSE). |
Logical value indicating whether the point is inside the polygon.
sp::point.in.polygon()
point <- c(2, 3)
polygon_df <- data.frame(x = c(1, 3, 3, 1), y = c(1, 1, 4, 4))
is_inside_plg(point, polygon_df) # Returns TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.