title: Adding RGB channel to the 2D matrix [R]
body: <p>Here is an example matrix:</p>
  <pre><code>mymat &lt;-matrix(runif(24*24), ncol=24) 
  </code></pre>
  <p>I can plot this matrix using ggplot2, so I can obtain color representation of values:</p>
  <pre><code>plot_mat &lt;- function(mat){
    mat_df&lt;- reshape2::melt(mat)
    plt &lt;- mat_df %&gt;% ggplot2::ggplot(aes(Var2, Var1)) + geom_raster(aes(fill = value)) +scale_fill_gradientn(colours = c('blue', 'green', 'yellow', 'red')) + theme_bw()
    return(plt)
  }
  
  plot_mat(mymat)
  </code></pre>
  <p>I would like to add RGB channel to my data without converting them into an image. I would like to add another dimension to my mymat, so the dim(mymat) output would look 24, 24, 3. Unfortunately, I do not know, how to do so.</p>
  <p>I would be grateful for your help.</p>