[Rd] sub and gsub treat \\ incorrectly (PR#13454)

amiransk at uwo.ca amiransk at uwo.ca
Mon Jan 19 19:25:12 CET 2009


Sub and gsub treat \\ replacement pattern incorrectly

I expect
  sub("a","\\", "a", perl=T)
to produce
  [1] "\"
instead it generates
  [1] ""

On the other hand, if I run
  sub("a","\\\\", "a", perl=T)
it correctly outputs
  [1] "\\"

The same issue applies to gsub.

--please do not edit the information below--

Version:
 platform = i386-pc-mingw32
 arch = i386
 os = mingw32
 system = i386, mingw32
 status = 
 major = 2
 minor = 8.1
 year = 2008
 month = 12
 day = 22
 svn rev = 47281
 language = R
 version.string = R version 2.8.1 (2008-12-22)

Windows XP (build 2600) Service Pack 2

Locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

Search Path:
 .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base

-- 
Sincerely,
 Andriy



More information about the R-devel mailing list