'How do I remove everything from the environment in one go whilst preserving functions?
I often like to clear all variables using rm(list = ls()) so that I can run a script from scratch; however, this command removes all objects, regardless of type.
I want to preserve all variables listed under 'Functions' in RStudio whilst removing everything else.
I ask because I have two functions in my environment which I would like to preserve, but I also don't want to have to manually type out rm(var1, var2, df1, df2, ...) each time I want to remove all variables whilst preserving the 'Functions'.
How can this be done?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
