#' add URL
#'
#' @param x object
#' @param href url
#' @param name name or anchor
#' @param target new
#'
#' @return add URL
#' @export
#'
html_URL <- function(x,href=NULL,name=NULL,target="new"){
if (do::left_equal(target,'new')){
target="_blank"
if (!is.null(href) & is.null(name)){
sprintf('<a href="%s" target="%s">%s</a>',href,target,x)
}else if (is.null(href) & !is.null(name)){
sprintf('<a href="#%s">%s</a>',name,x)
}else if (!is.null(href) & !is.null(name)){
sprintf('<a href="%s#%s" target="%s">%s</a>',href,name,target,x)
}
}else{
if (!is.null(href) & is.null(name)){
sprintf('<a href="%s">%s</a>',href,x)
}else if (is.null(href) & !is.null(name)){
sprintf('<a href="#%s">%s</a>',name,x)
}else if (!is.null(href) & !is.null(name)){
sprintf('<a href="%s#%s">%s</a>',href,name,x)
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.