Tidying Up

At the end of a session in R, it is good practice to remove (rm) any variables names you have created (using, say, x <−5.6) and to detach any dataframes you have attached earlier in the session (see p. 18). That way, variables with the same names but different properties will not get in each other's way in subsequent work:

rm(x,y,z)
detach(worms)

This command does not make the dataframe called wormsdisappear; it just means that the variables within worms, such as Slope and Area, are no longer accessible directly by name. To get rid of everything, including all the dataframes, type

rm(list=ls())

but be absolutely sure that you really want to be as draconian as this before you execute the command.

Get The R Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.