Data packages that expose tibbles - what to depend on?

When designing data packages that return tibbles, what are the recommended dependencies from the tidyverse?

For instance, I have this package https://github.com/martinjhnhadley/statesRcontiguous currenty it returns objects with the following class:

library(statesRcontiguous)
#> Loading required package: sf
#> Linking to GEOS 3.6.1, GDAL 2.1.3, proj.4 4.9.3
class(shp_all_us_states)
#> [1] "sf"         "tbl_df"     "tbl"        "data.frame"

I have sf in the depends list for the package, but fairly foolishly didn't include tibble.

But is that the recommended dependency, or is it recommended to load more of the tidyerse? I'm hesitant about just listing tidyverse as I feel that's unnecessarily greedy.

I try to keep dependencies as limited as possible, so in your case I'd suggest just making a dependency on tibble.

The way I see it the whole tidyverse is not a package in the same was as it's components are, it's just a wrapper for convenience (it has very few functions that it directly exports, and those it does are just convenience functions). If your package doesn't need (say) ggplot2 why would you include it as an (indirect) dependency via tidyverse?

1 Like