The goal of websearchr is to provide a convenient way of accessing domains and searching popular websites directly from the R console. When working on small screens in particular, switching from the R console to the browser window, opening a new tab, navigating to the desired website and finally searching for the search terms requires around 3-6 clicks. As one is working mainly in the R console, it is more convenient to start typing the search terms right away, without having to go through the process mentioned above. For example, stackoverflow("my r problem")
will open the stackoverflow search for "my r problem" in a new browser tab automatically.
Currently supported websites:
Any other domain can be accessed with web("example.com")
.
Twitter and Wikipedia can be searched in different languages than English. For example, to search the French version of Wikipedia use wikipedia("Langage de programmation", "fr")
.
To use a browser other than the default on your computer use options(browser = "path to browser")
. For example, on macOS options(browser = "/usr/bin/open -a '/Applications/Safari.app'")
or Windows options(browser = "C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe")
. To check which browser is set as the default use getOption("browser")
.
You can install websearchr from CRAN with:
install.packages("websearchr")
Or install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("fschaff/websearchr")
Please report issues or requests for additional functionality to https://github.com/fschaff/websearchr/issues.
library(websearchr)
# Try:
web("r-project.org")
#> Opening https://www.r-project.org in browser
google("my search terms")
#> Opening Google search for "my search terms" in browser
stackoverflow("my r problem")
#> Opening Stackoverflow search for "my r problem" in browser
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.