fawda123 / ggord

a take on ordination plots using ggplot2
https://fawda123.github.io/ggord/
62 stars 20 forks source link

Dependancy missing when running ggord #24

Closed user3386170 closed 3 months ago

user3386170 commented 3 months ago

Issues


I am re-running an old script from 2023 in which I had incorporated ggord to create the ellipses around my categorical factors (which worked fine last year). My current R is R-4.3.2 running on windows 11 Pro. I tried running the code from the github page and then installing the package (ggord R package version 1.1.7). I get an error message that ddply could not be found. I was able to fix it by running the package plyr. Perhaps ggplot2 used to call plyr in its dependencies so it was not necessary within ggord but now it does need it to be run explicitly?

# insert reprex here
library(dplyr)
library(gglot2)
ord <- prcomp(iris[, 1:4])

p <- ggord(ord, iris$Species)
p

#Error in ddply(obs, "Groups", function(x) { : 
 # could not find function "ddply"
library(plyr)
ord <- prcomp(iris[, 1:4])

p <- ggord(ord, iris$Species)
p
fawda123 commented 3 months ago

Hi, my guess is this is a namespace conflict between dplyr and plyr. I made the calls to ddply in the ggord() function explicit with plyr. Let me know if that doesn't work. I couldn't reproduce this on my end, but thanks for the reprex. https://github.com/fawda123/ggord/commit/22f7e4329f90ccb75c5b2867fb543e675f27bb1a

user3386170 commented 3 months ago

I opened a new R session and ran the same code again with your updated R script of the function and it ran smoothly. Thanks for taking care of it so quickly and for writing this helpful package.