IndrajeetPatil / ggstatsplot

Enhancing {ggplot2} plots with statistical analysis 📊📣
https://indrajeetpatil.github.io/ggstatsplot/
GNU General Public License v3.0
2.03k stars 190 forks source link

JOSS review: missing dependency #576

Closed kevinrue closed 3 years ago

kevinrue commented 3 years ago

When running the first chunk of code in the following section

https://github.com/IndrajeetPatil/ggstatsplot#ggwithinstats

Namely

# for reproducibility and data
set.seed(123)
library(WRS2) # for data
library(afex) # to run anova

# plot
ggwithinstats(
  data = WineTasting,
  x = Wine,
  y = Taste,
  title = "Wine tasting",
  caption = "Data source: `WRS2` R package",
  ggtheme = ggthemes::theme_fivethirtyeight(),
  ggstatsplot.layer = FALSE
)

I get the following error messages

Error in library(afex) : there is no package called ‘afex’
Error in loadNamespace(name) : there is no package called ‘ggthemes’

Obviously, running the following code solves the issue

install.packages('afex')
install.packages('ggthemes')

However, it would be nicer that dependencies are installed with the package itself, to avoid users running into those issues at runtime.


I can see afex in the Suggests section of the DESCRIPTION file.

However, even the full installation command in the README does not install ggthemes:

remotes::install_github(
  repo = "IndrajeetPatil/ggstatsplot", # package path on GitHub
  dependencies = TRUE, # installs packages which ggstatsplot depends on
  upgrade_dependencies = TRUE # updates any out of date dependencies
)

declares installing the following list of packages:

Installing_ 199 packages: mvtnorm, Rcpp, plyr, mime, magrittr, ini, httr, gitcreds, zip, sys, openssl, credentials, askpass, R6, yaml, withr, whisker, rstudioapi, rprojroot, rlang, rappdirs, purrr, lifecycle, jsonlite, glue, gh, gert, fs, desc, curl, crayon, clipr, cli, utf8, vctrs, pkgconfig, pillar, tibble, rematch2, fansi, diffobj, waldo, ps, processx, praise, pkgload, evaluate, ellipsis, digest, callr, brio, base64enc, htmltools, cpp11, systemfonts, fontLiberation, fontBitstreamVera, fontquiver, xfun, markdown, highr, fastmap, xml2, stringr, stringi, knitr, commonmark, brew, xopen, prettyunits, cachem, testthat, sessioninfo, rversions, roxygen2, rcmdcheck, pkgbuild, memoise, usethis, RcppEigen, RcppParallel, colorspace, viridisLite, RColorBrewer, munsell, labeling, farver, backports, matrixStats, checkmate, scales, isoband, gtable, BH, V8, loo, gridExtra, inline, ggplot2, StanHeaders, coda, Brobdingnag, jquerylib, sass, bslib, promises, later, sourcetools, xtable, httpuv, shiny, shinyjs, miniUI, htmlwidgets, rematch, progress, cellranger, readr, hms, forcats, tidyselect, RcppArmadillo, tidyr, generics, openxlsx, readxl, data.table, haven, conquer, MatrixModels, SparseM, numDeriv, dplyr, broom, sp, statmod, nloptr, minqa, lme4, rio, maptools, quantreg, pbkrtest, abind, carData, insight, bayestestR, parameters, effectsize, mc2d, reshape, BWStest, kSamples, SuppDists, Rmpfr, gmp, multcompView, zeallot, deSolve, contfrac, elliptic, hypergeo, gtools, pbapply, gdtools, freetypeharfbuzz, devtools, hunspell, tinytex, rstantools, rstan, logspline, LaplacesDemon, bridgesampling, colourpicker, reshape2, car, lmerTest, WRS2, performance, ipmisc, correlation, BayesFactor, prismatic, PMCMRplus, vdiffr, spelling, rmarkdown, metafor, metaBMA, ggExtra, afex, statsExpressions, patchwork, paletteer, pairwiseComparisons, ggsignif, ggrepel, ggcorrplot


For https://github.com/openjournals/joss-reviews/issues/3167

kevinrue commented 3 years ago

Hm.. thinking about this more, ggthemes is only used in the user session, i.e. it is not a dependency of ggstatsplot. So it is natural to leave it to users to install, if they wish to use it. Closing the issue

IndrajeetPatil commented 3 years ago

This is by design.

Error in library(afex) : there is no package called ‘afex’

As you mention, it is in Suggests and the package will suggest the user to install it if the function can't find it:

https://github.com/IndrajeetPatil/statsExpressions/blob/0360a69d77f426832e44e73e2dfa889f40a0a41b/R/oneway_anova.R#L198

even the full installation command in the README does not install ggthemes

This is because ggthemes plays no role at all in ggstatsplot functions. This example is just to show how one can aesthetically modify the default if one wishes to. All ggstatsplot functions have ggtheme argument, whose function is to allow users to install whatever theme package they wish to install. So if someone is choosing to use a theme from ggthemes package, it is safe to assume that they have it installed.