findFn | R Documentation |
Returns a data.frame from
RSiteSearch(string, "function")
which can be sorted and subsetted by user
specifications and viewed in an HTML
table.
The default sort puts first packages with the most
matches (Count
), with ties broken using
the sum of the match scores for all the hits in
that package (TotalScore
), etc.
findFn(string, maxPages = 100, sortby = NULL,
verbose = 1, ...)
string |
A character string. See
|
maxPages |
The maximum number of pages to download assuming 20 links per page. |
sortby |
a character vector specifying how the
|
verbose |
an integer: if 0, no output is printed to the console. The default 1 displays an initial line with the number of pages to be retrieved and the number of matches obtained; if the number of matches to be downloaded is less, this also is displayed on the initial line. This is followed by a second line counting the pages downloaded. If greater than 1, additional information is provided on the download process. |
... |
ignored |
findFn
searches the help pages of packages
covered by the RSiteSearch
archives. To
restrict the search to only packages installed
locally, use help.search
.
1. Access the RSiteSearch
engine
with string
, restricting to "functions",
storing Score
, Package
,
Function
, Date
, Description
,
and Link
in a data.frame
.
2. Compute Count
, MaxScore
and
TotalScore
for each Package
accessed. Combine them in a matrix
PackageSummary
.
3. Sort PackageSummary
in the order
defined by the occurrence of
c('Count', 'MaxScore', 'TotalScore', 'Package')
in sortby
.
4. Merge PackageSummary
with the
data.frame
of search matches.
5. Sort the combined data.frame
as
defined by sort.
.
6. Make the result have class
c("findFn", "data.frame")
and add
attributes matches
,
PackageSummary
, string
, and
call
.
7. Done.
an object of class
c('findFn', 'data.frame')
with columns
and attributes as follows:
Columns |
|
Attributes |
|
Spencer Graves, Sundar Dorai-Raj, Romain Francois.
Duncan Murdoch suggested the "???" alias for
findFn
and contributed the code for it.
Special thanks to Gennadiy Starostin,
Vienna University of Economics and Business
(Wirtschaftsuniversitaet Wien), who in early
2021 took over maintenance of the
RSiteSearch
data base, updated
its structure, and rewrote
findFn
to match.
Special thanks to Jonathan Baron, and Andy
Liaw. Baron maintained the
RSiteSearch
data base for many years.
Liaw and Baron created the RSiteSearch
function in the utils
package.
Thanks also to Patrice Kiener of 'InModelia'
in Paris, France, who helped me fix some syntax
problems stemming from changes in how an
itemized list is described in a *.Rd file.
http://www.namazu.org/doc/tips.html.en#weight
- reference on determining Score
help.search
to search only
installed packages.
RSiteSearch
,
download.file
findFn
searches only "Target: Functions"
from that site, ignoring the R-help archives.
For alternative R search capabilities, see:
* "Searching R Packages" on Wikiversity
* https://search.r-project.org for a list of alternative R search capabilities, each of which may be best for different types of inquiries.
* findFunction
for a completely
different function with a similar name.
# Skip these tests on CRAN,
# because they take more than 5 seconds
if(!CRAN()){
z <- try(findFn("spline", maxPages = 2))
# alternative
zq <- try(???spline(2))
# Confirm z == zq except for 'call'
attr(z, 'call') <- NULL
attr(zq, 'call') <- NULL
if(!(inherits(z, "try-error") ||
inherits(zq, "try-error"))){
all.equal(z, zq)
# To search for 2 terms, not necessarily together:
RSS <- try(findFn('RSiteSearch function', 1))
matches(RSS)
# To search for an exact string, use braces:
RSS. <- try(findFn('{RSiteSearch function}', 1))
matches(RSS.) # list(nrow = 0, matches = 0)
# example in which resulting page has some unicode characters
Lambert <- try(findFn("Lambert"))
Lambert
# Example that "found 2 link(s) without dates" on 2021-06-26
webScr <- try(findFn('web scraping'))
# Example that "found 0 matches" on 2021-09-06
try(findFn('{open history map}'))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.