You need to learn few housekeeping commands. A first time or experienced developer should use these commands. The top r functions are search(), objects(), list(), ls(), and detach().
House Keeping Functions in R
Objects
objects()
This command shows a list of variables you created during your session. You can delete any additional objects you created.
> objects()
character(0)
Search
search()
search()
[1] ".GlobalEnv" "tools:rstudio" "package:stats"
[4] "package:graphics" "package:grDevices" "package:utils"
[7] "package:datasets" "package:methods" "Autoloads"
[10] "package:base"
Search command shows the packages and dataframes you created.
Deleting Variables
> rm(x,y,z)
You can remove variables you created with R Languages. The command to create ‘x’ variable is as follows >x >- 5
>rm(list=ls())
The ‘rm’ function removes all the variables you defined in your session. The list() function is generic, and it shows all the object. In the above command, ls() is one object.
Online R Language for Practice
- This is the reference where you can do practice for R Language.
Detach() Function
The detach() function without arguments delete the first item in the search path. The return value from detaching is invisible. That means NULL value.