[R] Replacing backslashes with slashes

From: yvonnick noel <yvonnick.noel_at_uhb.fr>
Date: Wed 04 Jan 2006 - 22:02:13 EST


Hello,

I've seen this question asked in the archives but no clear reply or solution provided. So, just to be sure it is not possible in R: Can I replace backslashes with slashes in a string ?

I am writing a GUI for R with the Rpad library. I have a "browse" button for data loading and Windows return a path string with backslashes. I need to convert them into slashes to use the string with read.table.

I would have expected something like:

gsub("\\","\/","c:\My Documents\data.dat")

to work but it does not (incorrect regular expression).

Note that I have no control on the string which is returned from the system (no such problem under Linux BTW).

Any idea ?

Yvonnick NOEL
U. of Rennes 2

FRANCE



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jan 04 22:41:57 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:47 EST