R/reddit.r

Defines functions reddit

Documented in reddit

#' Search Reddit
#' @description Improve your workflow by searching Reddit directly from the console without having to switching to the browser and
#' opening a new tab first.
#' @param search_terms Search terms encapsulated in " ".
#' @keywords reddit internet workflow
#' @examples
#' reddit("my search terms")

#' @export
reddit <- function(search_terms) {
  if (missing(search_terms)) {
    message("Opening Reddit in browser")
    browseURL(paste0("https://www.reddit.com"))
  }
  else {
  message("Searching Reddit for \"", search_terms, "\" in browser")
  browseURL(paste0("https://www.reddit.com/search?q=", URLencode(search_terms)))
  }
}
fschaff/websearchr documentation built on Sept. 29, 2019, 11:10 p.m.