diff --git a/DESCRIPTION b/DESCRIPTION index bb05c99..cbc39c5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,6 @@ Depends: Imports: ggplot2 (>= 3.0.0), grid (>= 3.0.0), - plyr (>= 1.8.0), scales (>= 0.4.1), withr (>= 2.1.1) License: GPL-2 | file LICENSE diff --git a/NAMESPACE b/NAMESPACE index f5b2c4b..168a5c6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -70,6 +70,5 @@ importFrom(ggplot2,ggproto) importFrom(ggplot2,layer) importFrom(grid,gList) importFrom(grid,gTree) -importFrom(plyr,summarise) importFrom(scales,train_discrete) importFrom(stats,quantile) diff --git a/R/geoms-gradient.R b/R/geoms-gradient.R index 732fec3..9ff5383 100644 --- a/R/geoms-gradient.R +++ b/R/geoms-gradient.R @@ -239,7 +239,11 @@ GeomRidgelineGradient <- ggproto("GeomRidgelineGradient", Geom, data <- data[!missing_pos,] # munching for line - positions <- plyr::summarise(data, x = x, y = ymax, id = ids) + positions <- with(data, data.frame( + x = x, + y = ymax, + id = ids + )) munched_line <- ggplot2::coord_munch(coord, positions, panel_params) # We now break down the polygons further by fill color, since @@ -267,8 +271,11 @@ GeomRidgelineGradient <- ggproto("GeomRidgelineGradient", Geom, } # munching for polygon - positions <- plyr::summarise(data, - x = c(x, rev(x)), y = c(ymax, rev(ymin)), id = c(ids, rev(ids))) + positions <- with(data, data.frame( + x = c(x, rev(x)), + y = c(ymax, rev(ymin)), + id = c(ids, rev(ids)) + )) munched_poly <- ggplot2::coord_munch(coord, positions, panel_params) # calculate line and area grobs diff --git a/R/geoms.R b/R/geoms.R index 23a5aff..d930a28 100644 --- a/R/geoms.R +++ b/R/geoms.R @@ -97,7 +97,6 @@ geom_ridgeline <- function(mapping = NULL, data = NULL, stat = "identity", #' @format NULL #' @usage NULL #' @importFrom ggplot2 ggproto Geom -#' @importFrom plyr summarise #' @export GeomRidgeline <- ggproto("GeomRidgeline", Geom, default_aes = aes( @@ -258,12 +257,19 @@ GeomRidgeline <- ggproto("GeomRidgeline", Geom, ids[missing_pos] <- NA # munching for polygon - positions <- plyr::summarise(data, - x = c(x, rev(x)), y = c(ymax, rev(ymin)), id = c(ids, rev(ids))) + positions <- with(data, data.frame( + x = c(x, rev(x)), + y = c(ymax, rev(ymin)), + id = c(ids, rev(ids)) + )) munched_poly <- ggplot2::coord_munch(coord, positions, panel_params) # munching for line - positions <- plyr::summarise(data, x = x, y = ymax, id = ids) + positions <- with(data, data.frame( + x = x, + y = ymax, + id = ids + )) munched_line <- ggplot2::coord_munch(coord, positions, panel_params) # calculate line and area grobs diff --git a/R/geomsv.R b/R/geomsv.R index 9ea1650..348d45a 100644 --- a/R/geomsv.R +++ b/R/geomsv.R @@ -93,7 +93,6 @@ geom_vridgeline <- function(mapping = NULL, data = NULL, stat = "identity", #' @format NULL #' @usage NULL #' @importFrom ggplot2 ggproto Geom draw_key_polygon -#' @importFrom plyr summarise #' @export GeomVRidgeline <- ggproto("GeomVRidgeline", Geom, default_aes = aes(color = "black", fill = "grey80", x = 0, size = 0.5, linetype = 1, @@ -173,12 +172,19 @@ GeomVRidgeline <- ggproto("GeomVRidgeline", Geom, ids[missing_pos] <- NA # munching for polygon - positions <- plyr::summarise(data, - y = c(y, rev(y)), x = c(xmax, rev(xmin)), id = c(ids, rev(ids))) + positions <- with(data, data.frame( + y = c(y, rev(y)), + x = c(xmax, rev(xmin)), + id = c(ids, rev(ids)) + )) munched_poly <- ggplot2::coord_munch(coord, positions, panel_params) # munching for line - positions <- plyr::summarise(data, y = y, x = xmax, id = ids) + positions <- with(data, data.frame( + y = y, + x = xmax, + id = ids + )) munched_line <- ggplot2::coord_munch(coord, positions, panel_params) # placing the actual grob generation into a separate function allows us to override for geom_density_ridges2