當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。