Description Usage Arguments Details Value See Also Examples
View source: R/serach_functions.R
You may need a function which name you remember only partly. Use this function to serach all functions which name match whatever you remember.
1 | search_function(pattern, pkg_nm)
|
pattern |
Argument passed to |
pkg_nm |
A character string giving the name of the package to search. |
There are multiple ways to find a function in a package, e.g. with the
autocomplete feature in RStudio; by searching the package's index; and by
searching the function's reference in the package's website. However, there
is no way to do it programmatically. This function provides a programmatic
way to search functions in a package, based on a user-defined pattern, and
makes it easy to search multiple patterns at once via lapply()
.
A vector of characters
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # R loads a number of packages automatically. See what those packages are:
search()
# Directly search functions in any package already loaded: e.g. "base"
search_function("summary", pkg_nm = "base")
# Case is ignored
search_function("Summary", pkg_nm = "base")
# Easily search multiple patterns with lapply
multiple_patterns <- c("min", "ply")
lapply(multiple_patterns, search_function, pkg_nm = "base")
# If the package you want to search isn't load it, you must load it first.
## Not run:
library(ggplot2)
search_function("point", pkg_nm = "ggplot2")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.