获取 R 编程中所有附加包的列表 - search()函数
R 语言中的search()
函数用于获取 R 搜索路径中所有附加包的列表。
Syntax: search()
Parameters:
This function takes no parameters.
示例 1:
# R program to list the packages
# attached to R search path
# Calling search() function
search()
输出:
[1] ".GlobalEnv" "package:stats" "package:graphics"
[4] "package:grDevices" "package:utils" "package:datasets"
[7] "package:methods" "Autoloads" "package:base"
示例 2:
# R program to list the packages
# attached to R search path
# Attaching datasets to path
attach(airquality)
attach(BOD)
# Calling search() function
search()
输出:
[1] ".GlobalEnv" "BOD" "airquality"
[4] "package:stats" "package:graphics" "package:grDevices"
[7] "package:utils" "package:datasets" "package:methods"
[10] "Autoloads" "package:base"