help(package = "MASS")
帶你到INDEX文件爲MASS包(根據您的設置),在瀏覽器窗口中打開。要將該文件讀入控制檯,我們可以使用system.file()
獲取文件路徑,然後使用readLines()
將其作爲字符向量讀取。
## get the complete file path for the index file of the MASS package
f <- system.file("INDEX", package = "MASS")
## read it
readLines(f)
# [1] "Functions:"
# [2] "========="
# [3] ""
# [4] "Null Null Spaces of Matrices"
# [5] "addterm Try All One-Term Additions to a Model"
# [6] "anova.negbin Likelihood Ratio Tests for Negative Binomial GLMs"
# ...
# ...
或者我們可以把它包裝cat()
得到一個更清楚地版本
cat(readLines(f), sep = "\n")
# Functions:
# =========
#
# Null Null Spaces of Matrices
# addterm Try All One-Term Additions to a Model
# anova.negbin Likelihood Ratio Tests for Negative Binomial GLMs
# ...
# ...
或者,你可以用
readLines(file.path(find.package("MASS"), "INDEX"))
得到同樣的結果。最後,如果你想知道在html瀏覽器頂部出現的包描述和新聞鏈接,可以通過
packageDescription("MASS")
news(package = "MASS")
您正在詢問幫助文件的目錄(索引)。那是你要的嗎? –
嗨@RichardScriven。是的,包的索引。 – petobens
@RichardScriven它不是基本相同的東西,因爲使用'ls()'我需要首先加載包並且ii)我沒有簡要描述函數的功能。 – petobens