In one of my packages, fgeo, I'm trying to write a function to list all functions and datasets in itself (fgeo). For that I first need to add fgeo on the search list. I know I'm supposed to avoid calling library()
in functions of my packages but in this particular situation I can't think of an alternative.
Do you have a better idea?
add_fgeo_on_search_list <- function() {
library(fgeo)
search()
}
add_fgeo_on_search_list()
#> -- Attaching packages -------------------------------------------- fgeo 0.0.0.9000 --
#> v bciex 0.0.0.9000 v fgeo.habitat 0.0.0.9001
#> v fgeo.abundance 0.0.0.9002 v fgeo.map 0.0.0.9203
#> v fgeo.demography 0.0.0.9000 v fgeo.tool 0.0.0.9002
#>
#> [1] ".GlobalEnv" "package:fgeo.tool"
#> [3] "package:fgeo.map" "package:fgeo.habitat"
#> [5] "package:fgeo.demography" "package:fgeo.abundance"
#> [7] "package:bciex" "package:fgeo"
#> [9] "package:stats" "package:graphics"
#> [11] "package:grDevices" "package:utils"
#> [13] "package:datasets" "package:methods"
#> [15] "Autoloads" "package:base"