Permalink
Please
sign in to comment.
Showing
with
214 additions
and 1 deletion.
- +2 −1 DESCRIPTION
- +1 −0 NAMESPACE
- +19 −0 R/unfold_inside.R
- +1 −0 R/zzz.R
- +6 −0 docs/reference/index.html
- +166 −0 docs/reference/unfold_inside.html
- +19 −0 man/unfold_inside.Rd
@@ -0,0 +1,19 @@ | ||
|
||
#' Determine whether each point lies inside its seed | ||
#' | ||
#' @param data Data | ||
#' @param output String specifying a Column name | ||
#' | ||
#' @return Returns the original data tibble with a new column added | ||
#' @export | ||
unfold_inside <- function(data, output = "inside") { | ||
|
||
is_inside <- function(x, y, time) { | ||
sp::point.in.polygon(x, y, x[time==1], y[time==1]) | ||
} | ||
|
||
data %>% | ||
dplyr::group_by(id) %>% | ||
dplyr::mutate(!!output := is_inside(x, y, time)) %>% | ||
dplyr::ungroup() | ||
} |
0 comments on commit
eae7a25