开发者

Get the list of functions loaded in R's global environment [duplicate]

This question already has answers here: 开发者_如何转开发 Closed 11 years ago.

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 know ls() 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜