This will only work if the backslashes have already been escaped to double backslashes. For example, readr automatically does this when reading in windows file paths from csv files. If you are using as a standalone function, run this in the terminal: scan(what = "character, n = 1), paste the unmodified filepath at the blank line, and copy the modified file path as the argument, x.