Skip to content
Prev 32818 / 63424 Next

png() error in recent R-devel on Windows

Hi,

Tested with the latest r-devel snapshot build for Windows (2009-05-28 r48663):

 > png("test.png")
Error in png("test.png") : invalid value of 'fillOddEven'

The png() function is defined like this:

 > png
function (filename = "Rplot%03d.png", width = 480, height = 480,
     units = "px", pointsize = 12, bg = "white", res = NA, restoreConsole = TRUE)
{
     if (!checkIntFormat(filename))
         stop("invalid 'filename'")
     filename <- path.expand(filename)
     units <- match.arg(units, c("in", "px", "cm", "mm"))
     if (units != "px" && is.na(res))
         stop("'res' must be specified unless 'units = \"px\"'")
     height <- switch(units, `in` = res, cm = res/2.54, mm = res/25.4,
         px = 1) * height
     width <- switch(units, `in` = res, cm = res/2.54, mm = 1/25.4,
         px = 1) * width
     invisible(.External(Cdevga, paste("png:", filename, sep = ""),
         width, height, pointsize, FALSE, 1L, NA_real_, NA_real_,
         bg, 1, as.integer(res), NA_integer_, FALSE, .PSenv, NA,
         restoreConsole, "", FALSE))
}

Note that the call to .External has 19 arguments, the last 2 of them being
"" and FALSE but the devga() function defined in src/library/grDevices/src/init.c
expects 1 more argument (19 + the entry point name), the last 3 of them
being expected to be string (title), logical (clickToConfirm), and
logical (fillOddEven). So it seems like the recently added 'fillOddEven'
argument (r48294) is omitted in the .External call, hence the error.

 > sessionInfo()
R version 2.10.0 Under development (unstable) (2009-05-28 r48663)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

Cheers,
H.