📜  获取 R 编程中所有附加包的完整路径 – searchpath()函数

📅  最后修改于: 2022-05-13 01:55:00.870000             🧑  作者: Mango

获取 R 编程中所有附加包的完整路径 – searchpath()函数

R 语言中的searchpath()函数用于列出附加到 R 搜索路径的包的完整路径。

示例 1:

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


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()


输出:

[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"

示例 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()

输出:

[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"