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

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Mon 27 Jun 2005 - 14:09:01 EST

On 26 June 2005 at 20:30, Spencer Graves wrote:

| 	  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"

This does work, provided you remember that single backslashed "don't exist" as e.g. \a is a character in itself. So use doubles are you should be fine:

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

Hth, Dirk

-- 
Statistics: The (futile) attempt to offer certainty about uncertainty.
         -- Roger Koenker, 'Dictionary of Received Ideas of Statistics'

______________________________________________
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 Mon Jun 27 14:13:12 2005

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