Skip to content

Error in par(split.screens[[n]]) : parameter "i" in "mfg" is out of range

2 messages · Dan Kelley

#
I'm working on my 'oce' package, trying split.screen() instead of par(mfrow). 
My code is too long to post, and I hope it's ok that I ask this question
without doing so.

My code seems to work fine when I source() it, but when I do "R CMD check"
on my package, I get the error that I've put as the subject line, when it
runs examples.

If I comment out the plot() commands from my examples, and build the
package, then I can run those examples (with the plot() uncommented) from
the commandline, with no problems.  And I can run them from the console.  I
don't actually understand the error, although I can see that it is occurring
in a call to screen().

Has anyone else run across this?  Is there a trick I should employ, e.g.
making my package depend on the graphics package or setting up a virtual
device of some type for use in the building process?

PS. This is on OS X with the 2.8.1 version of R.
#
As a followup, in case this is of use to others, I got my code working by
altering R-2.8.1/src/library/graphics/R/screen.R slightly, removing the sole
reference to "mfg", as follows.


assign("par.list",
       c("xlog","ylog",
         "adj", "bty", "cex", "col", "crt", "err", "font", "lab",
         "las", "lty", "lwd", "mar", "mex",
         ##"mfg",                                                                                
         "mgp", "pch",
         "pty", "smo", "srt", "tck", "usr", "xaxp", "xaxs", "xaxt", "xpd",
         "yaxp", "yaxs", "yaxt", "fig"), envir=.SSenv)