Export all hidden functions from the package

Is there a way to automatically import all hidden functions from a package, i.e. functions available only with package:::fun ?

In fact, I made some changes to a given function that uses quite a lot of internal functions, and I want to avoid re-typing package::: everywhere.

I looked at the base function loadNamespace , but does not attach non-exported ones.

+7
namespaces r package
source share
1 answer

Ok, I finally found a kind of hack using this related post and eval :

 # get all the function names of the given package "mypack" r <- unclass(lsf.str(envir = asNamespace("mypack"), all = T)) # filter weird names r <- r[-grep("\\[", r)] r <- r[-grep("<-", r)] # create functions in the Global Env. with the same name for(name in r) eval(parse(text=paste0(name, '<-mypack:::', name))) 

I would think that in any case there is some kind of preliminary function.

+3
source share

All Articles