When I want to load a file into R, what would be a way to do so programmatically (or semi programmatically) instead of just manually copy paste the path and switch \\<
normalizepath
maybe what you are looking for:
> normalizePath(c(R.home(), tempdir()))
[1] "C:\\Program Files\\R\\R-3.1.0"
[2] "C:\\Users\\john\\AppData\\Local\\Temp\\RtmpysKuFi"
> normalizePath(c(R.home(), tempdir()), winslash = '/')
[1] "C:/Program Files/R/R-3.1.0"
[2] "C:/Users/john/AppData/Local/Temp/RtmpysKuFi"
Use readClipboard
if you are on windows and have problems copying and pasting filepaths. For example I copy a file path from a windows folder so it is on the clip board then I can use:
> readClipboard()
[1] "C:\\Users\\john\\AppData\\Local\\Temp"
You can then use `normalizePath to correct the windows flavour of paths.
Perhaps use choose.files() to pick the file followed by normalizePath() if you want to convert its path name to R's forward slashes.