如何在 R 中查找包内的函数?
R 中有很多软件包,每个软件包都有不同的目的,因此,这些软件包中的函数数量足以解决分析中的问题。一个软件包可能有十五个函数,而另一个可能有数百个,这完全取决于需要。我们可以使用 lsf.str 函数在软件包内查找函数,但在了解内部函数之前,我们需要加载该软件包。
示例 1
library(BSDA) lsf.str("package:BSDA") CIsim : function (samples = 100, n = 30, mu = 0, sigma = 1, conf.level = 0.95, type = "Mean") Combinations : function (n, k) EDA : function (x, trim = 0.05) normarea : function (lower = -Inf, upper = Inf, m, sig) nsize : function (b, sigma = NULL, p = 0.5, conf.level = 0.95, type = "mu") ntester : function (actual.data) SIGN.test : function (x, y = NULL, md = 0, alternative = "two.sided", conf.level = 0.95, ...) SRS : function (POPvalues, n) tsum.test : function (mean.x, s.x = NULL, n.x = NULL, mean.y = NULL, s.y = NULL, n.y = NULL, alternative = "two.sided", mu = 0, var.equal = FALSE, conf.level = 0.95) z.test : function (x, y = NULL, alternative = "two.sided", mu = 0, sigma.x = NULL, sigma.y = NULL, conf.level = 0.95) zsum.test : function (mean.x, sigma.x = NULL, n.x = NULL, mean.y = NULL, sigma.y = NULL, n.y = NULL, alternative = "two.sided", mu = 0, conf.level = 0.95)
示例 2
library(sqldf) lsf.str("package:sqldf") read.csv.sql : function (file, sql = "select * from file", header = TRUE, sep = ",", row.names, eol, skip, filter, nrows, field.types, colClasses, dbname = tempfile(), drv = "SQLite", ...) read.csv2.sql : function (file, sql = "select * from file", header = TRUE, sep = ";", row.names, eol, skip, filter, nrows, field.types, colClasses, dbname = tempfile(), drv = "SQLite", ...) sqldf : function (x, stringsAsFactors = FALSE, row.names = FALSE, envir = parent.frame(), method = getOption("sqldf.method"), file.format = list(), dbname, drv = getOption("sqldf.driver"), user, password = "", host = "localhost", port, dll = getOption("sqldf.dll"), connection = getOption("sqldf.connection"), verbose = isTRUE(getOption("sqldf.verbose")))
示例 3
library(rvest) lsf.str("package:rvest") %>% : function (lhs, rhs) back : function (x) follow_link : function (x, i, css, xpath, ...) google_form : function (x) guess_encoding : function (x) html : function (x, ..., encoding = "") html_attr : function (x, name, default = NA_character_) html_attrs : function (x) html_children : function (x) html_form : function (x) html_name : function (x) html_node : function (x, css, xpath) html_nodes : function (x, css, xpath) html_session : function (url, ...) html_table : function (x, header = NA, trim = TRUE, fill = FALSE, dec = ".") html_tag : function (x) html_text : function (x, trim = FALSE) is.session : function (x) jump_to : function (x, url, ...) minimal_html : function (title, html = "") pluck : function (x, i, type) repair_encoding : function (x, from = NULL) session_history : function (x) set_values : function (form, ...) submit_form : function (session, form, submit = NULL, ...) xml : function (x, ..., encoding = "") xml_node : function (x, css, xpath) xml_nodes : function (x, css, xpath) xml_tag : function (x)
广告