[Bioc-devel] "R CMD check" and par(mfrow=…) in vignettes

Martin Maechler maechler at stat.math.ethz.ch
Wed Aug 7 16:59:18 CEST 2013


>>>>> Martin Morgan <mtmorgan at fhcrc.org>
>>>>>     on Wed, 7 Aug 2013 05:14:35 -0700 writes:

    > On 08/06/2013 05:25 AM, Wolfgang Huber wrote:
    >> Hi
    >> 
    >> one of my packages [1] has several places in its vignette where multi-panel figures are generated via the likes of "par(mfrow=c(4,2))" within <<fig=TRUE>> code chunks. The package builds fine with 'R CMD build', and the vignette builds fine when calling Sweave manually. However, 'R CMD check' fails with
    >> * checking running R code from vignettes ...
    >> ‘Hiiragi2013.Rnw’ ... failed
    >> ERROR
    >> Errors in running code in vignettes:
    >> [..snip..]
    >> When sourcing ‘Hiiragi2013.R’:
    >> Error: figure margins too large
    >> 
    >> I believe this is because R CMD check calls Stangle on the .Rnw and then sources the .R file disregarding any device size settings. I can think of several ways to work around this, but this seems like a rather basic deficiency of the current system that asks for a more generic answer. Does anybody have any insight here?
    >> 

    > I guess these qualify as work-arounds

    > 1. From ?RweaveLatex, \setkeys{Gin}{width=\textwidth} though this doesn't 
    > actually help much

    > 2. par(mfrow=c(7,5), mar=par("mar")/2)

    > 3. output to pdf and then include separately

    > <<fig=FALSE>>=
    > pdf("foo.pdf", ...)
    > ...
    > dev.off()
    > @
    > \includgegraphics{foo}

Ok.... though
I'd find '3.' extremely ugly;  '1.' is what I'd use anyway, but
as you say, it may not be sufficient.

I'm indirectly using a better version of '2.', namely
I extensively use  
    sfsmisc::mult.fig()
instead of any par(mfrow= .) or par(mfcol= .)
but than I'm the author of that utility function...

What I really recommend is taking this to R-devel,
in spite of *some* people there, and their vitriolic way of
e-talking..

Martin Maechler


    > Not sure what you had in mind for a generic solution?
    > Martin

    >> Best wishes
    >> Wolfgang
    >> 
    >> PS I am sorry if this has been discussed elsewhere, but digging in the R-exts manual and in Google did not turn up a solution for me.
    >> 
    >> [1] https://hedgehog.fhcrc.org/bioc-data/trunk/experiment/pkg/Hiiragi2013
    >> _______________________________________________
    >> Bioc-devel at r-project.org mailing list
    >> https://stat.ethz.ch/mailman/listinfo/bioc-devel
    >> 


    > -- 
    > Computational Biology / Fred Hutchinson Cancer Research Center
    > 1100 Fairview Ave. N.
    > PO Box 19024 Seattle, WA 98109

    > Location: Arnold Building M1 B861
    > Phone: (206) 667-2793

    > _______________________________________________
    > Bioc-devel at r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/bioc-devel



More information about the Bioc-devel mailing list