
Collecting and Handling Point Pattern Data 69
Next we use the rgb command (f rom the standard grDevices package) to co nvert these numerical
values to the colour values r ecognised by R, which are character strings like "#96928F".
> mats <- rgb(arr[,,1], arr[,,2], arr[,,3])
> dim(mats) <- dim(arr)[1:2]
The matrix dimension s we re lost, so they are reinstated using dim<-. Finally we c onvert the matrix
of colour values to an image using im. To check the correct orientation and th e pixel aspect ratio,
we inspected the metadata for sandholes.jpg using the open source image editor GIMP.
> sand <- im(transmat(mats, "European", "spatstat"))
Since no other ...