48 CONTRIBUTED RESEARCH ARTICLES

Raster Images in R by Paul Murrell

Abstract The R graphics engine has new sup- 39837_s_at 1267_at 402_s_at 32562_at 37600_at 1007_s_at 36643_at 1039_s_at 40215_at 39781_at port for rendering raster images via the func- 266_s_at 307_at 38408_at 37539_at 1911_s_at 1463_at 2057_g_at 39556_at 41744_at 34789_at 34850_at rasterImage() grid.raster() 38631_at tions and . This 37280_at 36536_at 37006_at 41397_at 41346_at 40692_at 35714_at 1992_at 33244_at 40167_s_at 32872_at 34699_at 33440_at leads to better scaling of raster images, faster 36275_at 33809_at 40953_at 1308_g_at 1928_s_at 1307_at 40504_at 41742_s_at 41743_i_at 1674_at 40784_at 40785_g_at rendering to screen, and smaller graphics files. 37978_at 37099_at 1973_s_at 38413_at 2036_s_at 1126_s_at 31472_s_at 37184_at 35256_at 40493_at 41779_at 33412_at Several examples of possible applications of 37193_at 37479_at 39210_at 919_at 1140_at 41478_at 35831_at 176_at 37724_at 38385_at 41401_at 41071_at these new features are described. 39135_at 34961_at 37251_s_at 41470_at 1947_g_at 37810_at 36777_at 38004_at 177_at 36897_at 34106_at 31615_i_at 35665_at 33358_at 39315_at 41191_at 931_at 1914_at 36873_at 37809_at 39635_at 38223_at 33936_at 37558_at 41348_at 31605_at 205_g_at 32475_at 34247_at 36149_at 1500_at 34098_f_at 33528_at 35663_at 40393_at 33193_at 39716_at 33405_at 1929_at 36092_at 32215_i_at 41448_at 40763_at 873_at Prior to version 2.11.0, the core R graphics engine 37225_at 38056_at 37413_at 39424_at 32116_at 2039_s_at 40480_s_at 35816_at 1134_at 35260_at 39327_at 35769_at was entirely vector based. In other words, R was 33774_at 38032_at 34362_at 36650_at 41193_at 40088_at 40570_at 41266_at 36773_f_at 36878_f_at 41723_s_at 32977_at only capable of drawing mathematical shapes, such 38968_at 34210_at 37320_at 39717_g_at 36798_g_at 36398_at 40369_f_at 37967_at 32378_at 37043_at 41215_s_at 38096_f_at 36795_at as lines, rectangles, and polygons (and text). 675_at 1389_at 38095_i_at 38833_at 35016_at 676_g_at 41745_at 31508_at 1461_at 37420_i_at 37383_f_at 41237_at This works well for most examples of statistical 37039_at

graphics because plots are typically made up of data 26008 04006 63001 28028 28032 31007 24005 19005 16004 15004 22010 24001 28019 30001 28021 15005 09008 11005 28036 62001 27003 26003 62002 65005 84004 03002 20002 12012 22013 37013 14016 27004 49006 24011 08011 62003 12026 31011 43001 24017 68003 12006 24010 24022 08001 12007 01005 symbols (polygons) or bars (rectangles), with axes (lines and text) alongside (see Figure1). Figure 2: An example of an inherently raster graph- 2.0 3.0 4.0 0.5 1.5 2.5

● ● ● ical image: a heatmap used to represent microarray ● ● ● ● ● ●●● ●●●● ● ● ● Sepal.Length ●● ● ● ●●●● ● ● ● 7.5 ● ● ● ● ● ● ● ●●● ●●●●●●● ●● ● ● data. This image is based on Cock(2010); the data ● ●●● ● ●●●●● ●●● ●●● ●● ● ●●● ●●●●●● ●●● ●●●●●● ● ● ●●●●●●

● ● ●●● ●● ●●●●● ● ● ● ●● ●● ●● 6.5 ● ● ●●● ● ●●●●●●● ●● ●●●● ● ● ● ● ●● ● ● ●●●●●● ● ●● ● ●●●●●● ● ● ● ●●● ● ●●●●● ●● ●●● ● ●● ●● ● are from Chiaretti et al.(2004). ● ●●●● ●●●●● ● ● ● ● ● ●●●● ● ●● ● ● ● ●●●● ●●● ●● ● ● ●●●● ● ● ●● ● ● ●● ● ●● ● 5.5 ● ● ● ● ●●●●●●● ●●●●●●● ●●● ●●●●● ●● ●● ●● ● ● ●●●● ● ● ●●● ● ● ●● ● ● ●●●●● ●● ● ●● ● ●● ●●

● ● ● 4.5

● ● ● Another minor problem is that some PDF view- ● ● ● ● ● ● ● ● ● ● Sepal.Width ● ● ● 4.0 ● ● ●● ●●●● ●● ●●● ● ● ●●● ● ● ● ● ●● ● ● ● ● ●● ● ers have trouble reconciling their anti-aliasing algo- ●●● ● ●●●● ●● ● ●●●●●● ●●● ●●●●● ● ●● ●●● ● ●● ●● ● ● ●● ● ●● ● ● ● ● ● ●●● ● ● ●● ●●●● ●●●● ●●●●● ●●● ● ●● ● ● ● ●●● ● ●● ●● ●●●●●●● ●● ●● ● ● ●● ●● ●●● ●●●●●● ●●●● ●● ●● ●●●● ●●●●●●●●●●●●●● ● ●●● ●●●●●●● ●●●● ● ●● ●●●●●● ● ● ● ●●●●● ● ● ● ●●● ● 3.0 ●●● ●●●●● ● ● ● ●● ●●●●●● ● ● ● ●●●● ●●●●● ● rithms with a large number of rectangles drawn side ● ●●● ●● ●●● ●●● ● ●●● ● ●● ●●● ● ● ● ● ● ● ● ● ● ● ● ●● ●●● ● ● ● ●● ● ●● ● ● ● ● ●●●● ● ● ● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● by side and may end up producing an ugly thin line ● ● ● 2.0

● ● ● 7 ●● ● ● ● ●●● between the rectangles. ● ● ● ● ● ● ● ●● ● ● ● ●● ● ●● ● ● ●●● ●● ● ● ● ● ● ●●● 6 ●●● ●● ● ●● ●●●● Petal.Length ● ● ●●●●● ●●● ●● ●● ● ● ● ● ●●● ● ● ● ●● ● ●●●● ●●●● ● ● ●● ●●● ●●●●●● ●● ● ●●●●● ●● ● ●● ●●● ●● ● ● 5 ●●●●● ● ●●●●●● ●●●●● ● ●●●● ●●●●●● ●● ●● ●●●●● ● ●●●●●● To avoid these problems, from R version 2.11.0 ●●● ●● ● ●● ●● ● ●●●●●● ●● ●●●● ● ● ●● ● ●● ● ● ●● ● 4 ● ● ●● ● ●● ● ● ● ● ● ●● ●● ● ● ● ● 3 on, the R graphics engine supports rendering raster

● ● ● ● ● ● 2 ●●●● ● ● ●●●●●● ●● ●●●●● ●●●●●●●●●●● ●●●●●●●●●● ●● ● ●●●● ●●● ● ●● ● ● ● ● ● ●● ●●● ● ● ● ● ●● 1 elements as part of a statistical plot.

● ● ● ● ● ●●● ● ● ● ● ● ● ● ● 2.5 ●● ●●● ● ● ●●● ● ●●●●●●● ● ●● ● ● ● ● ●● ● ● ●●●● ● ● ●● ● ●●●●● ● ●● ● ●● ● ● ● ● ● ●●●● ●● Petal.Width ● ●● ● ● ●● ●●● ● ●●●●●●●● ●● ● ●●●●●● ●●● ●●●●● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ●● ●●●●●●●● ● ● ●●●●● ●●●●●●● ● ● ●●●● ●●●●●●● ● ●●●● ● 1.5 ●●● ●●●●● ● ● ●●●● ● ●●●●●●● ●●● ● ●●● ● ●●●●● ● ●● ●● ● ●● ●● ●●●● ● ●●● ●● ●●●●●

● ● ● ● ● ● ●● ● ● ● ●●● ● ●●●●● 0.5 ●●●●● ● ● ● ●● ● ●●●● ●●●●●●●●●●● ● ●●●●●●●●●● ● ● ●●●●●●●● ● ●● ● ●● ● ● ●●● functions 4.5 5.5 6.5 7.5 1 2 3 4 5 6 7

The low-level R language interface to the new Figure 1: A typical statistical plot that is well- raster facility is provided by two new func- described by vector elements: polygons, rectangles, tions: rasterImage() in the graphics package and lines, and text. grid.raster() in the grid package. For both functions, the first argument provides However, some displays of data are inherently the raster image that is to be drawn. This argument raster. In other words, what is drawn is simply an should be a "raster" object, but both functions will array of values, where each value is visualized as a accept any object for which there is an as.raster() square or rectangular region of colour (see Figure2). method. This means that it is possible to simply spec- It is possible to draw such raster elements using ify a vector, , or array to describe the raster vector primitives—a small rectangle can be drawn image. For example, the following code produces a for each data value—but this approach leads to at simple greyscale image (see Figure3). least two problems: it can be very slow to draw lots of small rectangles when drawing to the screen; and > library(grid) it can lead to very large files if output is saved in a vector file format such as PDF (and viewing the re- sulting PDF file can be very slow). > grid.raster(1:10/11)

The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 CONTRIBUTED RESEARCH ARTICLES 49

new raster functions—the interpolate argument. In most cases, a raster image is not going to be rendered at its “natural” size (using exactly one de- vice for each pixel in the image), which means that the image has to be resized. The interpolate argument is used to control how that resizing occurs. By default, the interpolate argument is TRUE, which means that what is actually drawn by R is a linear interpolation of the in the original im- age. Setting interpolate to FALSE means that what gets drawn is essentially a sample from the pixels in Figure 3: A simple greyscale raster image generated the original image. The former case was used in Fig- from a numeric vector. ure3 and it produces a smoother result, while the lat- ter case was used in Figure4 and the result is more As the previous example demonstrates, a nu- “blocky.” Figure5 shows the images from Figures3 meric vector is interpreted as a greyscale image, with and4 with their interpolation settings reversed. 0 corresponding to black and 1 corresponding to white. Other possibilities are logical vectors, which are interpreted as black-and-white images, and char- acter vectors, which are assumed to contain either > grid.raster(1:10/11, interpolate=FALSE) colour names or RGB strings of the form "#RRGGBB". The previous example also demonstrates that a > grid.raster(matrix(()[1:100], ncol=10)) vector is treated as a matrix of pixels with a single column. More usefully, the image to draw can be specified by an explicit matrix (numeric, logical, or character). For example, the following code shows a simple way to visualize the first 100 named colours in R. > grid.raster(matrix(colors()[1:100], ncol=10), + interpolate=FALSE)

Figure 5: The raster images from Figures3 and4 with their interpolation settings reversed.

The ability to use linear interpolation provides another advantage over the old behaviour of draw- ing a rectangle per pixel. For example, Figure6 Figure 4: A raster image generated from a character shows a greyscale version of the R logo image drawn matrix (of the first 100 values in colors()). using both the old behaviour and with the new raster support. The latter version of the image is smoother It is also possible to specify the raster image as a thanks to linear interpolation. numeric array: either three-planes of red, green, and blue channels, or four-planes where the fourth plane provides an “alpha” () . > download.file("http://cran.r-project.org/Rlogo.jpg", Greater control over the conversion to a "raster" + "Rlogo.jpg") object is possible by directly calling the as.raster() > library(ReadImages) function, as shown below. > logo <- read.jpeg("Rlogo.jpg") > grid.raster(as.raster(1:10, max=11)) > par(mar=rep(0, 4)) Interpolation > plot(logo) The simple image matrix example above demon- strates another important argument in both of the > grid.raster(logo)

The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 50 CONTRIBUTED RESEARCH ARTICLES

> plot(x, y, ann=FALSE, + xlim=xrange, ylim=yrange, + xaxs="i", yaxs="i") > rasterImage(image, + xrange[1], yrange[1], + xrange[2], yrange[2], + interpolate=FALSE)

● ● ●

10 ● Figure 6: The R logo drawn using the old behaviour ● ● of drawing a small rectangle for each pixel (left) and ● ●

using the new raster support with linear interpola- 5 ● tion (right), which produces a smoother result. ● ● ● In situations where the raster image represents ● ● 0 actual data (e.g., microarray data), it is important to ● ● preserve each individual “pixel” of data. If an image ● is viewed at a reduced size, so that there are fewer ● ● screen pixels used to display the image than there are −5 ● pixels in the image, then some pixels in the original ● ● image will be lost (though this is true whether the ● ●

image is rendered as pixels or as small rectangles). −10 ● What has been described so far applies equally to ● ● the rasterImage() function and the grid.raster() function. The next few sections look at each of these −10 −5 0 5 10 functions separately to describe their individual fea- tures. Figure 7: An image drawn from a matrix of normal- The rasterImage() function ized values using rasterImage().

The rasterImage() function is analogous to other It is also possible to rotate the image (about the low-level graphics functions, such as lines() and bottom-left corner) via the angle argument. rect(); it is designed to add a raster image to the cur- To avoid distorting an image, some calculations rent plot. using functions like xinch(), yinch(), and dim() (to The image is positioned by specifying the loca- get the dimensions of the image) may be required. tion of the bottom-left and top-right corners of the More sophisticated support for positioning and siz- image in user coordinates (i.e., relative to the axis ing the image is provided by grid.raster(). scales in the current plot). To provide an example, the following code sets up a matrix of normalized values based on a mathe- The grid.raster() function matical function (taken from the first example on the image() help page). The grid.raster() function works like any other grid graphical primitive; it draws a raster image > x <- y <- seq(-4*pi, 4*pi, len=27) within the current grid viewport. > r <- sqrt(outer(x^2, y^2, "+")) By default, the image is drawn as large as possible > z <- cos(r^2)*exp(-r/6) while still respecting its native aspect ratio (Figure3 > image <- (z - min(z))/diff(range(z)) shows an example of this behaviour). Otherwise, the > image is positioned according to the arguments x and y (justified by just, hjust, and vjust) and sized via The following code draws a raster image from this width and height. If only one of width or height is matrix that occupies the entire plot region (see Fig- given, then the aspect ratio of the image is preserved ure7). Notice that some work needs to be done to (and the image may extend beyond the current view- correctly align the raster cells with axis scales when port). the pixel coordinates in the image represent data val- x y width height ues. Any of , , , and can be vectors, in which case multiple copies of the image are drawn. > step <- diff(x)[1] For example, the following code uses grid.raster() > xrange <- range(x) + c(-step/2, step/2) to draw the R logo within each bar of a lattice bar- > yrange <- range(y) + c(-step/2, step/2) chart.

The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 CONTRIBUTED RESEARCH ARTICLES 51

> x <- c(0.00, 0.40, 0.86, 0.85, 0.69, 0.48, image data structure into a "raster" object. In the + 0.54, 1.09, 1.11, 1.73, 2.05, 2.02) absence of that, the simplest path is to convert the > library(lattice) data structure into a matrix or array, for which there already exist as.raster() methods. > barchart(1:12 ~ x, origin=0, col="white", In the example that produced Figure6, the R + panel=function(x, y, ...) { logo was loaded into R using the ReadImages pack- + panel.barchart(x, y, ...) "imagematrix" + grid.raster(logo, x=0, width=x, y=y, age, which created an object called + default.units="native", logo. This object could be passed directly to ei- + just="left", ther rasterImage() or grid.raster() because an + height=unit(2/37, "imagematrix" is also an array, so the predefined + "npc")) conversion for arrays did the job. + }) Profiling

12 This section briefly demonstrates that the claimed

11 improvements in terms of file size and speed of ren- dering are actually true. The following code gener- 10 ates a simple random test case image (see Figure9). 9 The only important feature of this image is that it is 8 a reasonably large image (in terms of number of pix-

7 els).

1:12 6 > z <- matrix(runif(500*500), ncol=500)

5

4

3

2

1

0.0 0.5 1.0 1.5 2.0 x

Figure 8: A lattice barchart of the change in the “level of interest in R” during 1996 (see demo(graphics)) Figure 9: A simple random test image. with the R logo image used to annotate each bar (with apologies to Edward Tufte and all of his heirs The following code demonstrates that a PDF ver- and disciples). sion of this image is more than three times larger if drawn using a rectangle per pixel (via the image() In addition to grid.raster(), there is also a function) compared to a file that is generated using rasterGrob() function to create a raster image grid.raster(). graphical object. > ("image.pdf") > image(z, col=grey(0:99/100)) Support for raster image packages > dev.off()

A common source of raster images is likely to be ex- > pdf("gridraster.pdf") ternal files, such as digital photos and medical scans. > grid.raster(z, interp=FALSE) A number of R packages exist to read general raster > dev.off() formats, such as JPEG or TIFF files, plus there are many packages to support more domain-specific for- > file.info("image.pdf", "gridraster.pdf")["size"] mats, such as NIFTI and ANALYZE. size Each of these packages creates its own sort of image.pdf 14893004 data structure to represent the image within R, so in gridraster.pdf 1511027 order to render an image from an external file, the data structure must be converted to something that The next piece of code can be used to demon- rasterImage() or grid.raster() can handle. strate that rendering speed is also much slower when Ideally, the package will provide a method for the drawing an image to screen as many small rectan- as.raster() function to convert the package-specific gles. The timings are from a run on a CentOS Linux

The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 52 CONTRIBUTED RESEARCH ARTICLES system with the Cairo-based X11 device. There are likely to be significant differences to these results if this code is run on other systems. 12 11 > system.time({ 10 + for (i in 1:10) { + image(z, col=grey(0:99/100)) 9

+ } 8 + }) 7

user system elapsed 1:12 6 42.017 0.188 42.484 5

4 > system.time({ + for (i in 1:10) { 3

+ grid.newpage() 2 + grid.raster(z, interpolate=FALSE) 1 + } + }) 0.0 0.5 1.0 1.5 2.0 x user system elapsed 2.013 0.081 2.372 Figure 11: A lattice barchart of the change in This is not a completely fair comparison because the “level of interest in R” during 1996 (see there are different amounts of input checking and demo(graphics)) with the a greyscale gradient used housekeeping occurring inside the image() function to fill each bar (once again, begging the forgiveness and the grid.raster() function, but more detailed of Edward Tufte). profiling (with Rprof()) was used to determine that most of the time was being spent by image() doing Another example is non-rectangular clipping op- the actual rendering. erations via raster “masks” (R’s graphics engine only supports clipping to rectangular regions). The code below is used to produce a of Spain that is filled Examples with black (see Figure 12). > library() This section demonstrates some possible applica- > par(mar=rep(0, 4)) tions of the new raster support. > map(region="Spain", col="black", fill=TRUE) The most obvious application is simply to use the new functions wherever images are currently being Having produced this image on screen, the function drawn as many small rectangles using a function like grid.cap() can be used to capture the current screen image(). For example, Granovskaia et al.(2010) used image as a raster object. the new raster graphics support in R in the produc- tion of gene expression profiles (see Figure 10). > mask <- grid.cap() Having raster images as a graphical primitive An alternative approach would be produce a PNG also makes it easier to think about performing some file and read that in, but grid.cap() is more conve- graphical tricks that were not necessarily obvious be- nient for interactive use. fore. An example is gradient fills, which are not ex- The following code reads in a raster image of plicitly supported by the R graphics engine. The fol- the Spanish flag from an external file (using the png lowing code shows a simple example where the bars package), converting the image to a "raster" object. of a barchart are filled with a greyscale gradient (see Figure 11). > library(png) > espana <- readPNG("1000px-Flag_of_Spain.png") > barchart(1:12 ~ x, origin=0, col="white", > espanaRaster <- as.raster(espana) + panel=function(x, y, ...) { + panel.barchart(x, y, ...) We now have two raster images in R. The follow- + grid.raster(t(1:10/11), x=0, ing code trims the flag image on its right edge and + width=x, y=y, trims the map of Spain on its bottom edge so that + default.units="native", the two images are the same size (demonstrating that + just="left", "raster" objects can be subsetted like matrices). + height=unit(2/37, + "npc")) > espanaRaster <- espanaRaster[, 1:dim(mask)[2]] + }) > mask <- mask[1:dim(espanaRaster)[1], ]

The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 CONTRIBUTED RESEARCH ARTICLES 53

(a) Chr 10 (b) Chr 3 (c) Chr 16

r 200 r 200 r 200 o o o t t t

c 150 c 150 c 150 a a a f f f

100 100 100 a a a

h 50 h 50 h 50 p p p l l l

a 0 a 0 a 0 200 200 200

150 150 150 8 8 8

2 100 2 100 2 100 c c c d d d

c 50 c 50 c 50

0 0 0 YJL156W−A TOM5 MSS18 CTF4 124000 126000 128000 202000 204000 206000 798000 800000 802000

FAR1 SSY5 TAF2

r 200 r 200 r 200 o o o t t t

c 150 c 150 c 150 a a a f f f 100 100 100 a a a h h h 50 50 50 p p p l l l

a 0 a 0 a 0 200 200 200

150 150 150 8 8 8

2 100 2 100 2 100 c c c d d d

c 50 c 50 c 50

0 0 0 (d) Chr 8 (e) Chr 12

r 200 r 200 o o t t CDS

c 150 c 150 a a f f

100 100 a a

h 50 h 50 CDS dubious p p l l

a 0 a 0 200 200 TF binding site 150 150 8 8

2 100 2 100 c c

d d Segment boundary

c 50 c 50

0 0 YHR140W 378000 380000 244000 246000 7

YHR138C SPS100 YHR139C−A YLR049C YLR050C YLR051C 6

r 200 r 200 o o

t t 5

c 150 c 150 a a f f 100 100 4 a a log2(expression level) h h 50 50 p p l l

a a 3 0 0 200 200

150 150 2 8 8

2 100 2 100 c c 1 d d

c 50 c 50

0 0 0

Figure 10: An example of the use of raster images in an R graphic (reproduced from Figure 3 of Granovskaia et al., 2010, which was published as an open access article by Biomed Central).

Now, we use the map as a “mask” to set all pixels dows device does not support images with a differ- in the flag image to transparent wherever the map ent alpha level per pixel.1 image is not black (demonstrating that assigning to There is no support for raster images for the "raster" subsets also works for objects). or PICTEX devices. http: > espanaRaster[mask != "black"] <- "transparent" A web page on the R developer web site, //developer.r-project.org/Raster/raster-RFC. html The flag image can now be used to fill a map of Spain, , will be maintained to show the ongoing state as shown by the following code (see Figure 12). of raster support.

> par(mar=rep(0, 4)) > map(region="Spain") > grid.raster(espanaRaster, y=1, just="top") Summary > map(region="Spain", add=TRUE) The R graphics engine now has native support for rendering raster images. This will improve render- Known issues ing speed and memory efficiency for plots that con- tain large raster images. It also broadens the set The raster image support has been implemented for of graphical effects that are possible (or convenient) the primary screen graphics devices that are dis- with R. tributed with R—Cairo (for Linux), Quartz (for Ma- cOS X), and Windows—plus the vector file format devices for PDF and PostScript. The screen device support also covers support for standard raster file Acknowledgements formats (e.g., PNG) on each platform. The X11 device has basic raster support, but ro- Thanks to the editors and reviewers for helpful com- tated images can be problematic and there is no sup- ments and suggestions that have significantly im- port for transparent pixels in the image. The Win- proved this article. 1However, Brian Ripley has added support in the development version of R.

The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 54 CONTRIBUTED RESEARCH ARTICLES

Figure 12: A raster image of the Spanish flag being used as a fill pattern for a map of Spain. On the left is a map of spain filled in black (produced by the map() function from the maps package). In the middle is a PNG image of Spanish flag (a public domain image from Wikimedia Commons, http://en.wikipedia.org/wiki/File: Flag_of_Spain.svg), and on the right is the result of clipping the Spanish flag image using the map as a mask.

Bibliography M. V. Granovskaia, L. M. Jensen, M. E. Ritchie, J. Toedling, Y. Ning, P. Bork, W. Huber, and R. Bivand, F. Leisch, and M. Maechler. pixmap: L. M. Steinmetz. High-resolution transcription Images (“Pixel Maps”), 2009. URL http://CRAN. atlas of the mitotic cell cycle in budding yeast. R-project.org/package=pixmap. R package ver- Genome Biology, 11(3):R24, 2010. URL http:// sion 0.4-10. genomebiology.com/2010/11/3/R24. S. Chiaretti, X. Li, R. Gentleman, A. Vitale, M. Vi- gnetti, F. Mandelli, J. Ritz, and R. Foa. Gene M. Loecher. ReadImages: Image Reading Module for R, http://CRAN.R-project.org/package= expression profile of adult T-cell acute lympho- 2009. URL ReadImages cytic leukemia identifies distinct subsets of pa- . R package version 0.1.3.1. tients with different response to therapy and sur- vival. Blood, 103(7):2771–2778, 2004. D. Sarkar. lattice: Lattice Graphics, 2010. URL http: //CRAN.R-project.org/package=lattice. R pack- P. Cock. Using R to draw a heatmap from microar- age version 0.18-3. ray data, 2010. URL http://www2.warwick.ac.uk/ fac/sci/moac/students/peter_cock/r/heatmap. O. S. code by Richard A. Becker and A. R. W. R. ver- Paul Murrell sion by Ray Brownrigg Enhancements by Thomas Department of Statistics P Minka . maps: Draw The University of Auckland Geographical Maps, 2009. URL http://CRAN. Private Bag 92019, Auckland R-project.org/package=maps. R package version New Zealand 2.1-0. [email protected]

The R Journal Vol. 3/1, June 2011 ISSN 2073-4859