How would you you make an image from a matrix in R?
Matrix values would correspond to pixel intensity on image (although I am just interested in 0,1 values white or black at the moment.), while column and row numbers correspond to vertical and horizontal location on the image.
By make an image I mean display it on the screen and save it as a jpg.
You can display it on the screen easiest using 'image':
m = matrix(runif(100),10,10) par(mar=c(0, 0, 0, 0)) image(m, useRaster=TRUE, axes=FALSE)
You can also have a look at the raster package...
1.4m articles
1.4m replys
5 comments
57.0k users