Creates an appropriate query string for a search engine and then opens up the resulting page in a web browser.

search_site(
  query,
  site = c("google", "bing", "duckduckgo", "ddg", "startpage", "sp", "qwant", "rseek",
    "rstudio community", "rscom", "twitter", "stackoverflow", "so", "github", "gh",
    "grep", "bitbucket", "bb"),
  rlang = TRUE
)

search_google(query = geterrmessage(), rlang = TRUE)

search_bing(query = geterrmessage(), rlang = TRUE)

search_duckduckgo(query = geterrmessage(), rlang = TRUE)

search_ddg(query = geterrmessage(), rlang = TRUE)

search_ixquick(query = geterrmessage(), rlang = TRUE)

search_startpage(query = geterrmessage(), rlang = TRUE)

search_sp(query = geterrmessage(), rlang = TRUE)

search_ecosia(query = geterrmessage(), rlang = TRUE)

search_rseek(query = geterrmessage(), rlang = TRUE)

search_qwant(query = geterrmessage(), rlang = TRUE)

search_rstudio_community(query = geterrmessage(), rlang = TRUE)

search_rscom(query = geterrmessage(), rlang = TRUE)

search_twitter(query = geterrmessage(), rlang = TRUE)

search_stackoverflow(query = geterrmessage(), rlang = TRUE)

search_so(query = geterrmessage(), rlang = TRUE)

search_github(query = geterrmessage(), rlang = TRUE)

search_gh(query = geterrmessage(), rlang = TRUE)

search_grep(query = geterrmessage(), rlang = TRUE)

search_bitbucket(query = geterrmessage(), rlang = TRUE)

search_bb(query = geterrmessage(), rlang = TRUE)

Arguments

query

Contents of string to search. Default is the error message.

site

Name of site to search on. Supported options: "google" (default), "bing", "duckduckgo", "startpage", "qwant","rstudio community", "twitter","stackoverflow", "github", "grep", and "bitbucket".

rlang

Search for results written in R. Default is TRUE

Value

The generated search URL or an empty string.

See also

search_google(), search_bing(), search_duckduckgo(), search_startpage(), search_rseek(), search_qwant(), search_twitter(), search_rstudio_community(), search_stackoverflow(), search_github(), search_grep(), search_bitbucket(), and searcher()

Examples

# Search in a generic way
search_site("r-project", "google")
#> Please type into your browser:
#> https://google.com/search?q=r-project%20r%20programming

# Search Google
search_google("r-project")
#> Please type into your browser:
#> https://google.com/search?q=r-project%20r%20programming

# Search Bing
search_bing("Microsoft R")
#> Please type into your browser:
#> https://bing.com/search?q=Microsoft%20R%20r%20programming

# Search DuckDuckGo
search_duckduckgo("R language")
#> Please type into your browser:
#> https://duckduckgo.com/?q=R%20language%20r%20programming

# Search startpage
search_startpage("VS Code")
#> Please type into your browser:
#> https://startpage.com/do/dsearch?query=VS%20Code%20r%20programming

# Search Rseek
search_rseek("searcher")
#> Please type into your browser:
#> https://rseek.org/?q=searcher%20

# Search Qwant
search_qwant("Quarto")
#> Please type into your browser:
#> https://www.qwant.com/?q=Quarto%20r%20programming

# Search RStudio Community
search_rstudio_community("RStudio IDE")
#> Please type into your browser:
#> https://community.rstudio.com/search?q=RStudio%20IDE

# Search Twitter
search_twitter("searcher")
#> Please type into your browser:
#> https://twitter.com/search?q=searcher %23rstats

# Search StackOverflow for Convolutions in the r tag
search_stackoverflow("convolutions")
#> Please type into your browser:
#> https://stackoverflow.com/search?q=convolutions%20[r]

# Search all languages on StackOverflow for convolutions
search_stackoverflow("convolutions", rlang = FALSE)
#> Please type into your browser:
#> https://stackoverflow.com/search?q=convolutions

# Search GitHub Issues for bivariate normal in the language:r
search_github("bivariate normal")
#> Please type into your browser:
#> https://github.com/search?q=bivariate%20normal%20language:r%20type:issue&type=Issues

# Search all languages on GitHub Issues for bivariate normal
search_github("bivariate normal", rlang = FALSE)
#> Please type into your browser:
#> https://github.com/search?q=bivariate%20normal&type=Issues

# Search R code on GitHub for numerical optimization
search_grep("optim")
#> Please type into your browser:
#> https://grep.app/search?q=optim%20&filter[lang][0]=R

# Search all code on GitHub for numerical optimization
search_grep("optim", rlang = FALSE)
#> Please type into your browser:
#> https://grep.app/search?q=optim

# Search BitBucket for assertions
search_bitbucket("assertions")
#> Please type into your browser:
#> https://bitbucket.com/search?q=assertions%20lang:r

if (FALSE) { # \dontrun{
# On error, automatically search the message on google
options(error = searcher("google"))
options(error = search_google)
} # }