 <p>You can create a matrix directly and just multiply the data with it:</p> <pre><code>as.matrix(trans_temp) * col(trans_temp) </code></pre> <hr> <h3>Benchmarking with eddi's</h3> <pre><code>m &lt;- as.data.frame(matrix(runif(1e7), ncol=1000)) x &lt;- seq_len(1000) system.time(tt1 &lt;- as.matrix(m) * col(m)) # 0.335 seconds system.time(tt2 &lt;- t(x*t(m))) # 0.505 seconds identical(tt1, tt2) # TRUE </code></pre>