当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


R语言 search()用法及代码示例


search()R语言中的函数用于获取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"     

相关用法


注:本文由纯净天空筛选整理自nidhi_biet大神的英文原创作品 Get a List of all the Attached Packages in R Programming – search() Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。