Open In App
Related Articles

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

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
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"     

Last Updated : 12 Jun, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads