2.7 Finding, describing and removing objects
In the previous data types section we have created a couple of lists, integers, numerics and a data.frame. This is the beginning of a data analysis workflow. While you are typing at your keyboard it is easy to become distracted and to forget the name of the variable that you created, or to create many temporary variables that you no longer need. Following are a few helpful functions you will commonly use during data transformation and analysis.
Tidying up objects
-
Use the
ls()
function to list all the variables in your workspace. -
Use
rm()
to get rid of a variable or variables that you no longer want.- To remove multiple objects, just enter the names of all those objects separated by commas
-
Delete everything from your workspace using
rm(list=ls())
-
Review your history (all the commands you have entered into the console in this session) using the RStudio History tab (top right window).
ls()
rm(h)
rm(x, y)
rm(list=ls())
history()