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


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


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

用法: searchpath()

参数:
这个函数没有参数。

范例1:


# R program to get the full path
# of attached packages in R
  
# 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:/PROGRA~1/R/R-215~1.2/library/base"

范例2:


# 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:/PROGRA~1/R/R-215~1.2/library/base"

相关用法


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