1

Is it bad to load too many packages ?

I'm still not an expert, and I don't always know what I will need, in terms of packages. Is it bad to just load 10 of them ? I tend to load at least all these everytime I work on data: If I learn about another package, I could def add it to this list.

tidyverse
janitor
readxl
ggplot2
dplyr
broom
ggpubr
Awake Joe
  • 39
  • 3
  • 2
    opinion questions are generally off-topic, also see https://stackoverflow.com/a/39137111/2994949 – rawr Mar 17 '22 at 21:37
  • 1
    Tidyverse will load `ggplot2` and `dplyr` so those lines are redundant. https://tidyverse.tidyverse.org/#usage – Jon Spring Mar 17 '22 at 21:39
  • 3
    This is likely to be closed as an opinion question. But: Yes and No. If it causes you problems, then Yes, if it doesn't, then No. I'd probably err on the side of only loading what you *need* to run your script rather than everything every time. Particularly if you work with other people or across systems. You have some redundancy in here anyway - several of these are already loaded by the *tidyverse* meta-package anyway - https://tidyverse.tidyverse.org/reference/tidyverse_packages.html – thelatemail Mar 17 '22 at 21:41
  • 2
    Opinions vary on this. If you are working on analysis by yourself and not creating packages, the main downside I can think of is that you may be more likely to run into conflicts, e.g. both `dplyr` and its antecedent `plyr` use many of the same names for functions. – Jon Spring Mar 17 '22 at 21:43
  • 2
    IMO it depends on what you intend to do. Packages developpers usually thought a lot about their package, so they are likely to write a better code than you would do in 10 minutes. So it's better to run a package for a quick analysis. But as for writing a public package, the less dependencies, the less problems to solve. As for writing a private package, a shiny app, or a recurrent production project, it's inbetween : don't be afraid to use the tools provided to you, you'll do more than writing from scrap, but you can use things like renv to freeze dependencies – Arnaud Feldmann Mar 17 '22 at 21:50
  • 1
    Maybe check out this talk: [It depends: A dialog about dependencies](https://www.rstudio.com/resources/rstudioconf-2019/it-depends-a-dialog-about-dependencies/) – MrFlick Mar 18 '22 at 00:21

0 Answers0