#' Access Domain
#' @description Improve your workflow by accessing web directly from R console.
#' @param address The web address you want to open, encapsulated in " ".
#' @param https if FALSE "http" will be used instead of the default "https".
#' @param suppressWWW if TRUE "www" will be suppressed and the user input will follow directly after https://
#' @keywords web workflow
#' @examples
#' web("r-project.org")
#' @export
web <- function(address, https = TRUE, suppressWWW = FALSE) {
if (missing(address)) {
message("Opening new browser tab")
browseURL(paste0("https://"))
}
else {
if (https == TRUE) {
a <- paste0("https://")
}
else {
a <- paste0("http://")
}
if (suppressWWW == FALSE) {
b <- paste0("www.", address)
}
else {
b <- paste0(address)
}
message("Opening ", a, b, " in browser")
browseURL(paste0(a, b))
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.