The ls() function allows us to look at a list of all of the objects, such as data and functions, that we have saved so far. The rm() function can be used to delete any that we don’t want.

> ls()
[1] "x" "y"
> rm(x, y)
> ls()
character (0)

It’s also possible to remove all objects at once:

rm(list=ls())