[R] escape character OK in R environment, fails in R CMD CHECK

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat May 22 16:07:29 CEST 2010



On 22.05.2010 08:18, Henrik Bengtsson wrote:
> R version/sessionInfo()?
>
> /H
>
> On Fri, May 21, 2010 at 10:08 PM, David Reiss<dreiss at systemsbiology.org>  wrote:
>> Hi,
>> I am trying to check a package via R CMD CHECK and it is failing with
>>
>> Error: '\s' is an unrecognized escape in character string starting "\s"
>>
>> The culprit looks something like this:
>>
>> gsub('\\s\\(.*\\)',"","this is a (test, man) dude")


I guess this is in the Examples of an Rd document, right? If so, you 
need to double escape, i.e.:
  gsub('\\\\s\\\\(.*\\\\)',"","this is a (test, man) dude")

Uwe Ligges





>> which is correctly escaped with the "\\"'s   -- but it seems that R CMD
>> CHECK is pre-escaping the string when it reads in the code to check it.
>>
>> How do I get R CMD CHECK to let the "\\s" 's through?
>>
>> Thanks.
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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