title: r image(x,y,col=rgb,...) function giving error
body: <p>I have the following code in R:</p>
  
  <pre><code>img = read.csv(file="img119.csv")
  </code></pre>
  
  <p>img is loaded like this:</p>
  
  <pre><code>X   Y   R   G   B
  1   0   0   0.48046875  0.65234375  0.83593750
  2   0   1   0.40234375  0.57031250  0.73828125
  3   0   2   0.24609375  0.39453125  0.54687500
  4   0   3   0.07031250  0.19921875  0.32031250
  5   0   4   0.00000000  0.07812500  0.17187500
  
  
  width = img[length(img[,1]),1]+1;
  
  height = img[length(img[,2]),2]+1;
  
  x = 1:width;
  
  y = 1:height;
  
  img[,3:5] = img[,3:5]/256;
  
  rgb_colors = rgb(img[,3:5])
  
  imgfunction &lt;-function(xx,yy){
  
    idx = xx*width + height - yy;
  
    rgb_color = rgb_colors[idx];
  
    return ( rgb_color )
  
  } 
  
  rgb_colors_xy = outer(x,y,imgfunction)
  
  image(x,y,rgb_colors)
  </code></pre>
  
  <p>I want to draw that csv file like a regular image. However, the last line gives me error as following: </p>
  
  <pre><code>Error in image.default(x, y, rgb_colors) : 'z' must be a matrix
  </code></pre>
  
  <p>I am not sure what I am doing wrong and appreciate if you help me fix this code. </p>
  
  <p>Thanks,</p>