Skip to content
Related Articles

Related Articles

Improve Article

Get a List of all the Attached Packages in R Programming – search() Function

  • Last Updated : 12 Jun, 2020

search() function in R Language is used to get the list of all the attached packages in the R search path.

Syntax: search()

Parameters:
This function takes no parameters.

Example 1:




# R program to list the packages
# attached to R search path
  
# Calling search() function
search()

Output:

[1] ".GlobalEnv"        "package:stats"     "package:graphics" 
[4] "package:grDevices" "package:utils"     "package:datasets" 
[7] "package:methods"   "Autoloads"         "package:base"     

Example 2:




# R program to list the packages
# attached to R search path
  
# Attaching datasets to path
attach(airquality)
attach(BOD)
  
# Calling search() function
search()

Output:

 [1] ".GlobalEnv"        "BOD"               "airquality"       
 [4] "package:stats"     "package:graphics"  "package:grDevices"
 [7] "package:utils"     "package:datasets"  "package:methods"  
[10] "Autoloads"         "package:base"     
My Personal Notes arrow_drop_up
Recommended Articles
Page :