Junior R developer here. I'm really not clear on the meaning of the LinkingTo field in an R package's dependencies.
What I would like to do is remove the package BH after I've installed the packages that have LinkingTo dependencies on it (in particular, dplyr). The package takes up 154MB and my use case is very space sensitive (deploying R in an AWS Lambda). I've tried removing it and haven't seen any negative consequences, but I'd like to understand the implications more thoroughly.
I know that Writing R Extensions says
Specifying a package in ‘LinkingTo’ suffices if these are C++ headers containing source code or static linking is done at installation: the packages do not need to be (and usually should not be) listed in the ‘Depends’ or ‘Imports’ fields.
However, this seems to say multiple conflicting things to me and I'm not sure I completely understand the terms to begin with. If it's static linking done at install, that suggests to me that LinkingTo packages are really only needed while the dependent package is compiling and thereafter any necessary capabilities will be packaged into the dependent package. The other statement, "if these are C++ header containing source code", is more ambiguous and suggests possible runtime dependencies. Meanwhile, "the packages do not need to be (and usually should not be) listed in the ‘Depends’ or ‘Imports’ fields" suggests, given my limited understanding of the meaning of Depends and Imports, that these dependencies are generally not needed at runtime.
So, are LinkingTo dependencies needed at runtime or only at compile time? Once the dependent package is installed, can I simply remove them to save space? More specifically, can I safely remove BH once dplyr is installed without impacting dplyr's capabilities?
In well over my head here and hoping someone can provide some advice!
Just for additional context, I did explore the reverse dependencies on BH on my system and got the following
> tools::dependsOnPkgs("BH",dependencies=c("Enhances"))
character(0)
> tools::dependsOnPkgs("BH",dependencies=c("Suggests"))
character(0)
> tools::dependsOnPkgs("BH",dependencies=c("Depends"))
character(0)
> tools::dependsOnPkgs("BH",dependencies=c("Imports"))
character(0)
> tools::dependsOnPkgs("BH",dependencies=c("LinkingTo"))
[1] "dplyr"
> tools::dependsOnPkgs("BH",dependencies=c("all"))
[1] "dplyr" "glue" "purrr" "tibble" "tidyr"
[6] "tidyselect" "ps" "stringr" "usethis" "callr"
[11] "devtools" "lubridate" "processx" "xopen" "naptime"
[16] "pillar" "pkgbuild" "rcmdcheck" "sessioninfo" "fs"
[21] "pkgload" "remotes" "rlang"
I'm a little confused about the results here as well... because my understanding is that "all" = c("Enhances","Suggests","Depends","Imports","LinkingTo") and yet I get back more dependencies using that parameter...