Most of articles, I have read. They recommend to use rm(list=ls()) but I do not know what is the difference if I like to use rm()
Can I use
rm() is basically 'remove{base}', it is used to Remove Objects from a Specified Environment.
Command rm(list=ls()) means-
list=ls() is base in this command that means you are referring to all the objects present in the workspace.
similarly, rm() is used to remove all the objects from the workspace when you use list=ls() as base.
However,
when it comes to using rm() alone it will not do anything as the 'base' is absent.
You can use rm() to remove specific variables to by putting them as 'base':
For example
a <-45
rm(a)