[R] Errors checking a library

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Nov 18 15:12:34 CET 2004


michael watson (IAH-C) wrote:

> Hi
> 
> I am writing an R library.  The documentation for one of my functions
> includes an example that I *know* works - simply cut and paste into R on
> either Windows and Linux and it works perfectly, no errors or warnings,
> nothing, nyet.
> 
> However, when I run "R CMD check" on the library, I get an error.  I am
> running R CMD check on linux, and the offending piece of code appears to
> be:
> 
> cox[cox$group %in% onc,]

You need to quote "%": "\%".

Uwe Ligges


> "cox" is a data frame, one of the columns of which is group, which
> contains numbers.  "onc" is a vector of numbers.
> 
> The output on Linux from R CMD check is this:
> 
> 
>># lots of code
>># lots of code
>>cox[cox$group
> 
> +
> +
> + # the rest of my code
> Error: syntax error
> Execution halted
> 
> As can be seen, my code "cox[cox$group %in% onc,]" seems to have been
> executed incorrectly.  Does R CMD check have a problem with the "%in%"
> operator?  It would seem that R has somehow got mixed up and has lost
> the rest of my command.
> 
> I'm using R 1.9.1 on Suse Linux 8.2.  The example code works fine on
> both Windows and Linux when cut-and-pasted into an R window.
> 
> Mick
> 
> ______________________________________________
> 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




More information about the R-help mailing list