Try
   
  > name<-"C:\\myfile.txt"
  > name
[1] "C:\\myfile.txt"
  > gsub("([\\])","\\/",name)
[1] "C:/myfile.txt"

yvonnick noel <[EMAIL PROTECTED]> wrote:
  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
  


                        
---------------------------------

 Ring in the New Year with Photo Calendars. Add photos, events, holidays, 
whatever.
        [[alternative HTML version deleted]]

______________________________________________
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

Reply via email to