#' @export
get_script_name <- function(){
path <- this.path::this.path()
basename(
tools::file_path_sans_ext(path)
)
}
#' Appends "_x" to "string" if x is not a matching string
#' warns about the changes
#' @param string a named string: string = c(opt = "value")
#' @param x a string
#' @return "string_x"
#' @export
#'
no_match_append <- function(string,x){
if(length(string) >1){stop("input not a string")}
name <- names(string)
string_match <- grepl(x, string)
if(string_match){
warning(paste0("\n\n", name, ": '", string,"'\n",
"already contains the string: '",x,"'\n",
name, " stays: ", x))
string
}else{
new_string <- paste0(string,"_",x)
warning(paste0("\n", name, ": ", string,"\n'",
string, "' would switch to: '", new_string,"'."))
new_string
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.