[R] using ls() to find a function
Carl Witthoft
carl at witthoft.com
Sat Dec 18 17:39:22 CET 2010
Oddly enough, I posted my little cutie recently:
lstype<-function(type='closure'){
#
inlist<-ls(.GlobalEnv)
if (type=='function') type <-'closure'
typelist<-sapply(sapply(inlist,get),typeof)
return(names(typelist[typelist==type]))
}
And, not useful for functions, but to find the size of a pile of data
objects,
thefloats<-lstype('numeric')
sapply(sapply(sapply(sapply(thefloats,get),unlist),as.vector),length)
More information about the R-help
mailing list