Re: how to put a single backslash into a string, to make file paths usable on windows

"Richard O'Keefe" <[email protected]> Fri, 8 May 2026 14:30:36 +1200
Newsgroups gmane.comp.lang.r.general
Message-ID <CABcYAdK0BJXKXcYVniFyhvw_Ye4gQjV=xHXXKovm0J_08zQxsw@mail.gmail.com>
This isn't an R thing.  The Windows system calls that accept file names
accept both kinds of slash indifferently.  I've seen it said that this goes
back to MS-DOS 2, but certainly it's all NT versions.  If you need to link
C and/or Fortran with R, you can safely use / in file name strings in those
languages too.

On Fri, 8 May 2026 at 01:18, Chris Ryan <[email protected]> wrote:

> 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
> >
>
> ______________________________________________
> [email protected] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]