[R] Using Sub

Lopez, Dan lopez235 at llnl.gov
Fri Jun 15 00:23:03 CEST 2012


Hi,

I have been trying to get the sub function to work but can't for the life of me figure it out. I tried looking at ?sub but I think there is something that I am just not understanding. 

Example failed attempts
> sub("\\","/","G:\Compensation Audits_Reports\Step Audit\Steps off Step.accdb")
Error: '\C' is an unrecognized escape in character string starting "G:\C"

> sub("\\","/","G:\Compensation Audits_Reports\Step Audit\Steps off Step.accdb",fixed=TRUE)
Error: '\C' is an unrecognized escape in character string starting "G:\C"

> sub("\\","/","G:\Compensation Audits_Reports\Step Audit\Steps off Step.accdb",fixed=FALSE)
Error: '\C' is an unrecognized escape in character string starting "G:\C")

> sub("/","\","G:\Compensation Audits_Reports\Step Audit\Steps off Step.accdb")
Error: unexpected symbol in "sub("/","\","G"

Thanks.
Dan



More information about the R-help mailing list