Open In App

Get the Full Path of all the Attached Packages in R Programming – searchpath() Function

Improve
Improve
Like Article
Like
Save
Share
Report

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

Syntax: searchpath()
Parameters: 
This function takes no parameters. 
 

Example 1: 
 

Python3




# R program to get the full path
# of attached packages in R
 
# Calling searchpath() function
searchpath()


Output: 
 

[1] ".GlobalEnv"
[2] "C:/Program Files/R/R-2.15.2/library/stats"
[3] "C:/Program Files/R/R-2.15.2/library/graphics"
[4] "C:/Program Files/R/R-2.15.2/library/grDevices"
[5] "C:/Program Files/R/R-2.15.2/library/utils"
[6] "C:/Program Files/R/R-2.15.2/library/datasets"
[7] "C:/Program Files/R/R-2.15.2/library/methods"
[8] "Autoloads"
[9] "C:/PROGRAM~1/R/R-215~1.2/library/base"

Example 2: 
 

Python3




# R program to get the full path
# of attached packages in R
 
# Attaching datasets to path
attach(BOD)
attach(airquality)
 
# Calling searchpath() function
searchpath()


Output: 
 

[1] ".GlobalEnv"
[2] "BOD"
[3] "airquality"
[4] "C:/Program Files/R/R-2.15.2/library/stats"
[5] "C:/Program Files/R/R-2.15.2/library/graphics"
[6] "C:/Program Files/R/R-2.15.2/library/grDevices"
[7] "C:/Program Files/R/R-2.15.2/library/utils"
[8] "C:/Program Files/R/R-2.15.2/library/datasets"
[9] "C:/Program Files/R/R-2.15.2/library/methods"
[10] "Autoloads"
[11] "C:/PROGRAM~1/R/R-215~1.2/library/base"

 


Last Updated : 04 Apr, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads