Arcadia-Science / sourmashconsumr

Working with the outputs of sourmash in R
https://arcadia-science.github.io/sourmashconsumr/
Other
24 stars 3 forks source link

Remove if statements associated with package loading #11

Closed taylorreiter closed 2 years ago

taylorreiter commented 2 years ago

I was being a dummy. @elizabethmcd pointed out in #8 that there had to be a better way to check for loaded packages...she was right. I got confused in the docs here https://r-pkgs.org/dependencies.html#guarding-the-use-of-a-suggested-package and essentially wrote if statements for any package I was using. However, these if statements are only for suggested packages...right now, I don't have anything as a suggest, everything is a dependencies and as such is imported. if you go to load the package and you don't have one of these libraries installed, it will prompt you with something like:

The packages `dplyr`, `ggplot2`, `readr`, and `tidyr` are required.
Would you like to install them?

This is based on the DESCRIPTION file.

In the long run, I could switch metacoder (and eventually, phyloseq) and other packages that are pain to install from dependencies to suggests, and I can guard there installations with code like this. but for now I'm comfortable with all of these just being dependencies that are imported.

FYI I re-ran all of the tests locally and they passed.