From 22f7e4329f90ccb75c5b2867fb543e675f27bb1a Mon Sep 17 00:00:00 2001 From: fawda123 Date: Tue, 16 Jul 2024 15:45:48 -0400 Subject: [PATCH] make ddply call explicit in ggord --- DESCRIPTION | 4 ++-- NAMESPACE | 1 - R/ggord.R | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a4a80c3..29603d6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: ggord Type: Package Title: Ordination Plots with ggplot2 Version: 1.1.7 -Date: 2022-03-24 +Date: 2024-07-16 Author: Marcus W. Beck [aut, cre] Maintainer: Marcus W. Beck Description: Create ordination biplots with ggplot2. Multiple methods are @@ -33,5 +33,5 @@ Suggests: Authors@R: person(given = "Marcus W.", family = "Beck", role = c("aut","cre"), email = "mbafs2012@gmail.com") -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index f3fed1a..e84a095 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -20,4 +20,3 @@ S3method(ggord,princomp) S3method(ggord,rda) export(ggord) import(ggplot2) -import(plyr) diff --git a/R/ggord.R b/R/ggord.R index ae2bf2b..fd20f5f 100644 --- a/R/ggord.R +++ b/R/ggord.R @@ -50,7 +50,7 @@ #' #' @export #' -#' @import ggplot2 plyr +#' @import ggplot2 #' #' @return A \code{\link[ggplot2]{ggplot}} object that can be further modified #' @@ -368,7 +368,7 @@ ggord.default <- function(obs, vecs, axes = c('1', '2'), grp_in = NULL, cols = N theta <- c(seq(-pi, pi, length = 50), seq(pi, -pi, length = 50)) circle <- cbind(cos(theta), sin(theta)) - ell <- ddply(obs, 'Groups', function(x) { + ell <- plyr::ddply(obs, 'Groups', function(x) { if(nrow(x) <= 2) { return(NULL) } @@ -384,7 +384,7 @@ ggord.default <- function(obs, vecs, axes = c('1', '2'), grp_in = NULL, cols = N names(ell)[2:3] <- c('one', 'two') # get convex hull for ell object, this is a hack to make it work with geom_polygon - ell <- ddply(ell, .(Groups), function(x) x[chull(x$one, x$two), ]) + ell <- plyr::ddply(ell, 'Groups', function(x) x[chull(x$one, x$two), ]) if(poly){ @@ -408,7 +408,7 @@ ggord.default <- function(obs, vecs, axes = c('1', '2'), grp_in = NULL, cols = N if(!is.null(obs$Groups)){ # get convex hull - chulls <- ddply(obs, .(Groups), function(x) x[chull(x$one, x$two), ]) + chulls <- plyr::ddply(obs, 'Groups', function(x) x[chull(x$one, x$two), ]) if(poly){