statquant statquant - 1 year ago 73
R Question

How can Iist only functions and those that come from a package

I use the

package to parallelize some stuff and I am tired of indicating 5 functions in
everytime I need to use it.

I know I can do
but this transfers a lot of data to the workers and slow me down (there can be big tables defined).

So the question is how can I list only functions in the

I did that:

getAllFunctions <- function(envir=.GlobalEnv){
allClasses <- sapply(grep(x=ls(envir), pattern='^%', value=TRUE, invert=TRUE), FUN=function(x){class(eval(parse(text=x)))})
fnNames <- names(allClasses)[allClasses == 'function']

But that's ugly (and gives everything) and I'm sure there is an idiomatic way

Answer Source

From the comments:

as.list(.GlobalEnv)[sapply(.GlobalEnv, is.function)]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download