Skip to content
Prev 43197 / 398513 Next

how to keep functions while remove all other commands

Hi, it's not clear what you asking for, but if you want to remove all
object except functions here's the shortest one-line solution that I
can think of

 rm(list=ls()[!sapply(ls(), FUN=exists, mode="function")])

Henrik Bengtsson
Lund University, Sweden