6

Is there a function or command in R which could clear all the global environment, just like clear in Matlab. I only know the function rm that needs me to put every variable name in it if I want to remove it. That's really not convenient.

Thanks

neilfws
  • 32,751
  • 5
  • 50
  • 63
Shixiang Wang
  • 2,147
  • 2
  • 24
  • 33
  • 10
    `rm(list=ls())` . – SymbolixAU Apr 11 '17 at 03:06
  • Do you use RStudio? If so you can click the broom icon in the "Environment" tab. There are R commands to achieve the same thing but given this is something this is generally done manually I think using the GUI is OK. – Marius Apr 11 '17 at 03:07
  • 1
    rm(list = ls())? – din Apr 11 '17 at 03:07
  • Yeah, really a good answer. Thanks. – Shixiang Wang Apr 12 '17 at 11:45
  • This question and its answer (in the comment above) is much clearer and to the point that the question of which this one has been marked as a duplicate. I've voted to reopen this question. If anything the dup should go the other way. – Robert Dodier Apr 30 '20 at 22:23

0 Answers0