[R] How to convert "c:\a\b" to "c:/a/b"?

Spencer Graves spencer.graves at pdf.com
Mon Jun 27 05:30:52 CEST 2005


	  How can one convert back slashes to forward slashes, e.g, changing 
"c:\a\b" to "c:/a/b"?  I tried the following:

 > gsub("\\\\", "/", "c:\a\b")
[1] "c:\a\b"

	  Since this didn't work, I eliminated the replacement as a contributor 
as follows:

 > gsub("X", "/", "c:XaXb")
[1] "c:/a/b"

	  The following seems to illustrate the problem:

  strsplit("c:\a\b", "")
[[1]]
[1] "c"  ":"  "\a" "\b"

	  How can one automate this?

	  Thanks,
	  spencer graves
-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915




More information about the R-help mailing list