R/backslash.R

#' Replaces Copied Backslashes (\) with Forwardslashes (/)
#'
#'@description This function will take a string from your clipboard and replace
#'    all of the backslashes (\) with forward slashes (/). The results
#'    are written back to your clipboard, so all you need to do is
#'    paste (CTRL + V).
#'
#'    I use this almost exclusively to make filepaths copied from Windows
#'    compatible with R.
#'
#'@param clipboard A string copied to your clipboard
#'
#'@return A string written to your clipboard. No explicit output.
#'
#'@examples
#' # Example Workflow
#' # Step 1: Navigate to the file you want in your file browser
#' # Step 2: Copy the file path
#' # Step 3: Run the backslash() function
#' # Step 4: Use CTRL + V
#'
#' backslash()
#'
#'@export
backslash <- function() {

writeClipboard(gsub("\\\\", "/", readClipboard()))

}
christian-million/researchR documentation built on May 15, 2019, 12:45 p.m.