[Bioc-devel] [biocore] Sweave changes (keep.source = TRUE or FALSE?) (fwd)

Vincent Carey 525-2265 stvjc at channing.harvard.edu
Tue Dec 5 22:04:36 CET 2006


(in case you didn't get this as it was sent to r-core instead of
bioc-devel...)

>
> Sorry to join in late, I was travelling last week. First, let me thank
> Duncan for his work, this really fixes one of the main drawbacks
> Sweave had!
>
> Hence, I agree with Duncan and Martin in that I would like to change
> the default in R to keep.source=TRUE. But I understand Robert that
> testing software gets hard if the tools which are used for testing
> change.

It seems to me that if you are changing the API/behavior then we users
have
to adapt to that, given sufficient warning.  This means that instead of
Sweave("foo.Rnw"), I have to write Sweave("foo.Rnw", keep.source=FALSE),
to get the former behavior, right?

It may still be debatable whether keep.source=TRUE is a desirable default.
It does propagate comments, but Sweave is supporting literate programming,
so that comments in code are not necessarily crucial for the objective
of the Sweave user.  The document narrative is supposed to take care
of commenting.  It is also not clear to me that keeping the source
formatting is preferable to the programmatic formatting by the interpreter
display facility.

So I would say there are real questions about the suitability of
keep.source=TRUE
as a default for Sweave.  The availability is definitely nice, but the
spirit and aesthetic aspects of Sweave use may be better supported in
many cases, perhaps the vast majority of all documents created to date,
with
keep.source=FALSE.

>
> As discussed by email this summer on r-devel I want to change another
> Sweave default for 2.5: I want to set stylepath=FALSE and include no
> \usepackage{/path/to/Sweave.sty} by default. This means in effect that
> each Sweave file needs to be adapted, by either inserting
> \usepackage{Sweave} or \SweaveOpts{stylepath=true} in the header. I
> didn't implement the changes back then because the discussion was too
> close to feature freeze.
>
> I also will do some other Sweave changes over christmas break, but
> those should all be safe, i.e., only add functionality.
>
> Before people now start yelling at me: We can only improve software,
> if we are allowed to change it and/or fix behavior that can be
> considered a bug. And the paths inserted on Windows machines in an
> English locale are buggy (and were so ever since ...).
>
In the past windows users had to do something to deal with undesirable
latex resource path generation with Sweave, I have some recollection
of that.  Now all users have to do something to get the old behavior?
Is it not possible to fix the windows path generation problem at
the R level instead?

Assuming not, then I have to write

Sweave("foo.Rnw", keep.source=FALSE, stylepath=TRUE)

to get the old behavior on non-windows machines.  I can't remember
what I might have to do to get the desired behavior on windows
machines.

>
> To make future changes easier I want to suggest the following (for
> BioC): Have all package authors insert a
>
>       \SweaveInput{BiocSweaveDefaults}
>
> at the beginning of each vignette, and centrally provide a
> BiocSweaveDefaults.Rnw file with settings we think are appropriate for
> BioC (details to be discussed). With that we would have easy means of
>
>  1) changing Sweave when necessary, but
>  2) keeping defaults in sync for all BioC vignettes, and overriding
>     changes we don't like.
>
> If we include the usapackage{Sweave} statement in
> BiocSweaveDefaults.Rnw, we have central control for all Sweave
> processing options as well as for latex options like noae or nogin.
>
> Comments?
>
Personally I try to avoid external determinants of function behavior
whenever possible.  I would rather be able to read in a document how
function
parameters should be set to get a certain behavior, than to read in
a document that I need to find and modify an external resource
configuration file
to get a certain behavior.

For my personal situation, if I put

Sweave = function(...) utils::Sweave(..., keep.source=FALSE,
stylepath=TRUE)

in my .Rprofile, I would get the old behavior (right?), and nothing else
needs to change.  I might need a different approach under windows, and
trouble may brew when I use --vanilla, alas.

In summary, I use Sweave a lot, it should evolve, and I appreciate the
alert to alterations of default behaviors.  I encourage further deliberation about
the ultimate default on keep.source.



More information about the Bioc-devel mailing list