[Rd] Tips for debugging: R CMD check examples

hadley wickham h.wickham at gmail.com
Wed Jun 30 17:32:03 CEST 2010


> How did you 'run' it?   I suspect you source()d it, not at all the same
> thing.  I have yet to encounter a problem which
>
> R --vanilla < foo-Ex.R
>
> or perhaps
>
> env LANGUAGE=en R --vanilla --encoding=latin1 < foo-Ex.R
>
> did not reproduce.

Thanks, that was exactly what I was looking for.  I hadn't tried
running it in batch mode.

> Rather, the default (along with many others) differs in interactive use and
> batch running.   If you had used a command like those a few lines about you
> would have had 'keep.source = FALSE' set.

I think the root of the problem is the way that source is written - it
uses a global option in an internal branch, which is difficult to
notice unless you read the source code. It seems like a good principle
that global options should only affect program behaviour by modifying
the function arguments.

>> Hopefully this type of problem will be easier to sort out with the new
>> pure R R CMD check in 2.11.
>
> Maybe (if you meant the one in R-devel, 2.12.0-to-be). But the examples are
> run in a sub-process just as before, so your very rare mis-assumption still
> needs an understanding of how R code is run.

Ooops, yes, I meant 2.12.0-to-be.  I was thinking it would make the
problem easier for me to understand because I'm more inclined to read
R code rather than perl code.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-devel mailing list