Created
March 7, 2019 18:25
-
-
Save mjsteinbaugh/0837fb32bf5c14488ce92065cc065767 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Normalize a Windows file path from the clipboard. | |
# | |
# Single backslash is an escape character in R. | |
# Sanitize `\` to either `\\` or `/` (preferred). | |
# | |
# Otherwise, you'll hit this error: | |
# Error: '\p' is an unrecognized escape in character | |
# | |
# Note that this only works in R running on Windows. | |
# Linux/macOS R doesn't have the `readClipboard()` function. | |
normalizePath( | |
path = readClipboard(), | |
winslash = "/", | |
mustWork = TRUE | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment