[R] replace double backslash with singel backslash

Jim Holtman jholtman at gmail.com
Fri Nov 4 11:44:04 CET 2011


what is the problem that you are trying to solve?  you need the double \\ since they have a special meaning in quoted strings.  in this case they represent a since backslash.  if you really had a single one, then something like this '\n' would be a carriage return.  

Sent from my iPad

On Nov 4, 2011, at 5:35, Kay Cichini <Kay.Cichini at uibk.ac.at> wrote:

> I want to replace \\ with \ in:
> str <-
> "C:\\DOKUME~1\\u0327336\\LOKALE~1\\Temp\\RtmpQ5NJ8X\\TIRIS_PICS\\1_Img.jpg"
> 
> and tried:
> gsub("\\\\", "\\", str)
> 
> but this removes the \\ without replacing them by \
> 
> Any help much appreciated,
> Kay
> 
> -----
> ------------------------
> Kay Cichini
> Postgraduate student
> Institute of Botany
> Univ. of Innsbruck
> ------------------------
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/replace-double-backslash-with-singel-backslash-tp3989434p3989434.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list