[R] how to put a single backslash into a string, to make file paths usable on windows

Chris Ryan cwr @end|ng |rom @gency@t@t|@t|c@|@com
Thu May 7 15:18:09 CEST 2026


It had been about a year since I had worked in Windows, and apparently I
had gotten rusty. Forward slashes in path names, as in

read.csv("e:/path/to/datafileOnWindows.csv")

work just fine in R on Windows.

Sorry for the bother.

--Chris Ryan



Chris Ryan wrote:
> I'm trying to generalize one of my scripts so that it will run on my
> Linux Mint computer at home and my client's Windows 11 computer at work.
>  I'm encountering trouble when setting file paths, conditional on which
> computer the script is running on. It's the Windows backslash issue
>



More information about the R-help mailing list