R/path_prep.R

Defines functions path_prep

Documented in path_prep

#' Converts Windows filepath to R format
#' 
#' Keep input in the clipboard (or paste it in).
#' Returns a valid R filepath string.
#' Found on StackOverflow, original author Tyler Rinker.
#' 
#' @param path Defaults to clipboard.
#' 
#' @export
path_prep <- function(path = "clipboard") {
    y <- if (path == "clipboard") {
        readClipboard()
    } else {
        y <- path
        #cat("Please enter the path:\n\n")
        #readline()
    }
    x <- chartr("\\", "/", y)
    writeClipboard(x)
    return(x)
}
pocdata/pocr documentation built on Jan. 5, 2022, 9:54 a.m.