From h.wickham at gmail.com  Wed Jun 30 17:32:03 2010
From: h.wickham at gmail.com (hadley wickham)
Date: Wed, 30 Jun 2010 10:32:03 -0500
Subject: [Rd] Tips for debugging: R CMD check examples
In-Reply-To: <alpine.LFD.2.00.1006301544250.20658@gannet.stats.ox.ac.uk>
References: <1277884730.7384.4.camel@desktop.localdomain>
	<AANLkTil6N-jeo4geAOPdjKPHWD0FIshNH5V5vkwiDA8s@mail.gmail.com> 
	<alpine.LFD.2.00.1006301544250.20658@gannet.stats.ox.ac.uk>
Message-ID: <AANLkTilYdMSAplzib-NBdGhh8kgH-vLnNMC4KJlBuNiV@mail.gmail.com>

> 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/



[Rd] Tips for debugging: R CMD check examples
hadley wickham