Query Search Portals from R
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
man Release candidate sent to CRAN Jul 1, 2018


Travis-CI Build StatusCRAN RStudio mirror downloadsCRAN_Status_BadgeCoverage Status


The goal of searcher is to provide a search interface directly inside of R. For example, within R, there is now the ability to look up rcpp example numeric vector or ggplot2 fix axis labels without having to open a browser, go to a search site, and type the query. By default, the search functions automatically search the last error on call.


The searcher package is available on both CRAN and GitHub. The CRAN version is considered stable while the GitHub version is in a state of development and may break. You can install the stable version of the searcher package with:


For the development version, you can opt for:





Search Terms

The search_*() functions can be used to search a query directly from R on major search engines, code repositories, and help websites. The following search platforms are supported: Google, Bing, ixquick, DuckDuckGo, StackOverflow, GitHub, and BitBucket. By default, an appropriate suffix for each platform that ensures relevant results to R is appended to all queries. This behavior can be disabled by using rlang = FALSE.

# Searching R project on major search engines
search_google("R project")
search_bing("R project")
search_ixquick("R project")
search_duckduckgo("R project")                           # or search_ddg(...)

# Searching for linear regression questions for R and in general
search_stackoverflow("linear regression")
search_stackoverflow("linear regression", rlang = FALSE) # or search_so(...)

# Searching GitHub Issues for maps in R and other languages
search_github("maps", rlang = FALSE)                     # or search_gh(...)

# Searching BitBucket for assertions in R and other languages
search_bitbucket("assertions", rlang = FALSE)            # or search_bb(...)

Search Errors

searcher offers preliminary support for automatically or manually searching errors that are generated in R. For more robust error search support and to also search warning messages, please use the errorist package.


Searching the last error automatically is possible by registering a function as R’s error handler via either searcher(site="") or one of the search_*() functions. Thus, when an error occurs, this function will automatically be called. This triggers a new browser window to open with the error term listed in verbatim.

# Using the generic search error handler
options(error = searcher("google"))

# Directly specify the search function
options(error = search_github)
options(error = search_google)


Alternatively, these functions can also be used manually so that the default error dispatch is preserved. In the manual case, you will have to explicitly call the search function. After that, a browser window will open with the last error message as the search query on the desired search portal.

search_duckduckgo()    # or search_ddg()
search_stackoverflow() # or search_so()
search_github()        # or search_gh()
search_bitbucket()     # or search_bb()


The idea for searcher began as a project to automatically search errors and warnings that occurred while working with R after a conversation among Dirk Eddelbuettel, Barry Rowlingson, and myself. However, there was no search interface that allowed querying directly from R outside of the built-in utils::RSiteSearch(), which only queries http://search.r-project.org/, and the sos package, which queries an off-site user premade database. Both of these options were focused solely on querying R documentation made available by packages. Given the nature of errors generally being undocumented, neither of these approaches could be used. Thus, searcher was unintentionally born to provide a means for errorist, which contains a robust way to automatically searching errors and warnings.

Special Thanks


GPL (>= 2)