[R] testing the contents of an environment

Tim Bergsma timb at metrumrg.com
Thu Sep 27 20:52:20 CEST 2007


Suppose I want to delete everything in my working directory that is not 
a function. It seems that

sapply(ls(),is.function)

always returns FALSE, because ls() returns objects of mode character. 
How do I evaluate is.function(), not on a character string, but on the 
object that character string represents?

Thanks,

Tim



More information about the R-help mailing list