R语言 获取所有附加包的列表 – search()函数
R语言中的 search() 函数用于获取R语言搜索路径中的所有附属包的列表。
语法: search()
参数:
这个函数不需要参数。
例子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"