[R] replacing backslashes with slashes using gsub

Jeff Gentry jgentry at jimmy.harvard.edu
Mon May 24 16:03:07 CEST 2004


> gsub("\\\\","/","D:\Prog\R\rw1090\library\cluster\libs")
> [1] "D:ProgR\rw1090libraryclusterlibs"

Probably not the best way, but what about escaping all the backslashes in
the original string?
 gsub("\\\\","/","D:\\Prog\\R\\rw1090\\library\\cluster\\libs")




More information about the R-help mailing list