Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
Permalink
Browse files

adds initial version of unfold_inside()

  • Loading branch information
djnavarro committed Dec 24, 2019
1 parent b74dfda commit eae7a252fbede73b779df59176b68f24c721dbfe
Showing with 214 additions and 1 deletion.
  1. +2 −1 DESCRIPTION
  2. +1 −0 NAMESPACE
  3. +19 −0 R/unfold_inside.R
  4. +1 −0 R/zzz.R
  5. +6 −0 docs/reference/index.html
  6. +166 −0 docs/reference/unfold_inside.html
  7. +19 −0 man/unfold_inside.Rd
@@ -29,7 +29,8 @@ Imports:
gganimate,
e1071,
magick,
spatstat
spatstat,
sp
URL: https://github.com/djnavarro/jasmines
BugReports: https://github.com/djnavarro/jasmines/issues
RoxygenNote: 7.0.2
@@ -20,6 +20,7 @@ export(scene_rows)
export(scene_sticks)
export(style_ribbon)
export(style_walk)
export(unfold_inside)
export(unfold_loop)
export(unfold_meander)
export(unfold_slice)
@@ -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()
}
@@ -8,6 +8,7 @@ utils::globalVariables(c(".", "V1", "V2", "V3", "V4", "V5", "V6", "aes",
"char_ind", "id", "series", "time", "x2", "xpos", "y2", "ypos"))
utils::globalVariables(c("char", "make_bridges", "seed_x", "seed_y"))
utils::globalVariables(c("xend", "yend", "al"))
utils::globalVariables(":=")

#
# img_rescale <- function(from, to, scale) {

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

0 comments on commit eae7a25

Please sign in to comment.
You can’t perform that action at this time.