Talbot Katz wrote:> Hi.
>
> I am using R 2.5.1 on a Windows XP machine. Here is an example of a piece
> of code I was running in older versions of R on the same machine. I am
> looking for underscores and replacing them with periods. This result is
> from R 2.4.1:
>
>> gsub ( "\\_+","\.","AAA_I")
> [1] "AAA.I"
>
> Here is what I get in R 2.5.1:
>
>> gsub ( "\\_+","\.","AAA_I")
> [1] "AAA.I"
> Warning messages:
> 1: '\.' is an unrecognized escape in a character string
> 2: unrecognized escape removed from "\."
>
> I still get the same result, which is what I want, but now I get a warning
> message. Am I actually doing something wrong that the previous versions of
> R didn't warn me about? Or is this warning message unwarranted? Is
there a
> fully approved method for getting the same functionality? Thanks!
Yes, correct usage is either
gsub ( "\\_+", ".", "AAA_I")
or
gsub ( "\\_+", "\\.", "AAA_I")
Uwe Ligges
> -- TMK --
> 212-460-5430 home
> 917-656-5351 cell
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.