title: Two dimensional heatmap with R
body: <p>I have an input file of this form:</p>
  
  <pre><code> 0.35217720               1         201           1
   0.26413283               1         209           1
   1.1665874                1         210           1
   ...
   0.30815500               2         194           1
   0.15407741               2         196           1
   0.15407741               2         197           1
   0.33016610               2         205           1
   ...
  </code></pre>
  
  <p>where the first column is a scalar value, the second is the x coordinate of a discrete lattice, the third is the y coordinate and the last one is time-like discrete component.
  I would like to make a two dimensional heatmap of the scalar values at fixed time. How can i do? <strong>Edit:</strong> I don't know how to use image() to use the second and the third column as x, y coordinates.</p>
  
  <p><strong>Example file:</strong></p>
  
  <pre><code>  7.62939453              1           1           1
    1.3153768               1           2           1
    7.5560522               1           3           1
    4.5865011               1           4           1
    5.3276706               1           5           1
    2.1895909               2           1           1
    0.47044516              2           2           1
    6.7886448               2           3           1
    6.7929626               2           4           1
    9.3469286               2           5           1
    3.8350201               3           1           1
    5.1941633               3           2           1
    8.3096523               3           3           1
    0.34571886              3           4           1
    0.53461552              3           5           1
    5.2970004               4           1           1
    6.7114925               4           2           1
    7.69805908              4           3           1
    3.8341546               4           4           1
    0.66842079              4           5           1
    4.1748595               5           1           1
    6.8677258               5           2           1
    5.8897662               5           3           1
    9.3043633               5           4           1
    8.4616680               5           5           1
  </code></pre>