is_point_in_path: Check if a point is contained in a polygon

Description Usage Arguments Functions Examples

View source: R/polygon_operations.R

Description

based on: https://en.wikipedia.org/wiki/Even

Usage

1
2
3
is_point_in_path(x, y, poly)

is_point_df_in_path(point_df, poly_df)

Arguments

x

The x coordinates of point.

y

The y coordinates of point.

poly

a list of numeric vectors defining the polygon list(c(x, y), c(x, y), ...) or a data.frame data.frame(x = c(0,0,1), y = c(0,1,1))

point_df

a data.frame defining the points to check, column names are expected

poly_df

a data.frame defining a polygon, column are expected

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
poly_selection <- data.frame(
  Petal.Length = c(2, 4, 6),
  Sepal.Width = c(2, 4, 2)
)

dplyr::mutate(
  iris,
  point_in_poly = is_point_in_path(
    Petal.Length,
    Sepal.Width,
    poly_selection
  )
)

jspaezp/flowhelperrr documentation built on Jan. 1, 2021, 7:10 a.m.