Get the list of functions loaded in R's global environment [duplicate]
Possible Duplicate:
Is there a way to get a vector with the name of all functions that one could use in R?
Hi
I would like to get from R the list of functions loaded in the environment.
I knowls()
that gives the list of objects loaded. But some objects are not functions.
I would like to clean my env from the functions but not from the other objects (matrices, array etc) that contain some of my result that dont want to lose.
Any idea?
See ?lsf.str
X <- lsf.str()
as.vector(X) # just for printing purposes, you can use the vector in rm()
rm(list=X)
ok, I have a proposal
rm(list=ls()[sapply(ls(), function(obj) "function"==class(eval(parse(text = obj)))[1])])
I am sure there is something more elegant.
精彩评论