[Rd] possible bug: graphics::image seems to ignore getOption("preferRaster")

Dr Gregory Jefferis jefferis at mrc-lmb.cam.ac.uk
Thu Mar 20 01:22:19 CET 2014


the details section of ?image says:

> If useRaster is not specified, raster images are used when the 
> getOption("preferRaster") is true, the grid is regular and either 
> dev.capabilities("raster") is "yes" or it is "non-missing" and there 
> are no missing values.

but in my experience this is never the case and 
getOption("preferRaster") is ignored. As far as I can see, the logic for 
checking this is in image is broken here:

   ras <- dev.capabilities("raster")
   if (identical(ras, "yes"))
     useRaster <- TRUE

because dev.capabilities("raster") returns a list like this (on my 
machine, R.version in footer)
> $rasterImage
> [1] "yes"

You can test this by doing:

   ras=structure(list(rasterImage = "yes"), .Names = "rasterImage")
   identical(ras,'yes') # returns FALSE

so the test would need to be something like:

   ras <- dev.capabilities("raster")[[1]]
   if (identical(ras, "yes"))
     useRaster <- TRUE

I can't find any relevant changes in R news
	
	http://stat.ethz.ch/R-manual/R-devel/doc/html/NEWS.html

This discussion

	https://www.mail-archive.com/r-devel@r-project.org/msg22811.html

suggests that Simon Urbanek may have added the useRaster option and 
looking at git blame on this mirror repo:

	https://github.com/wch/r-source/blame/c3ba5b0be36d3a1290e18fe189142c88f1e43236/src/library/graphics/R/image.R#L111-L120

suggests that Brian Ripley's svn commit 56949 was the last to touch 
these lines:

	https://github.com/wch/r-source/commit/b9012424f895bf681daf1b85255942547d495bcd

Thanks for any pointers if I am missing something!

Best wishes,

Greg Jefferis.


> R.version
                _
platform       x86_64-apple-darwin10.8.0
arch           x86_64
os             darwin10.8.0
system         x86_64, darwin10.8.0
status
major          3
minor          0.3
year           2014
month          03
day            06
svn rev        65126
language       R
version.string R version 3.0.3 (2014-03-06)
nickname       Warm Puppy

--
Gregory Jefferis, PhD
Division of Neurobiology
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge, CB2 OQH, UK

http://www2.mrc-lmb.cam.ac.uk/group-leaders/h-to-m/g-jefferis
http://jefferislab.org
http://flybrain.stanford.edu



More information about the R-devel mailing list