How to generate counts of positive values by column in data.table
<p>I have some data tables that consist of several columns and many thousands of rows.
My data looks something like:</p>

<pre><code>iteration V1  V2  V3  V4
1         -2  3   -4   1
2         -2  3   -3   4
3         -2  3    7   -8
4         -2  3   -4   2
5         -2  3   -4   -3
</code></pre>

<p>I have been trying to figure out how to calculate counts of positive values in each column, and the proportion of positive counts to all counts in a column. </p>

<p>This seems fairly simple but I can't figure out how to output a data.table that has counts by column in it.</p>

<p>I can do this by combining a bunch of the following statements, but there has to be a better way- any advice for a tired mind?</p>

<pre><code>nrow(dat[v2&gt;=0])
</code></pre>