Calulations within same category
<p>Small data frame example:</p>

<pre><code>    ID      V1       V2    is
1   01 23569.5 0.138996 FALSE
2   01 23611.5 1.318343  TRUE
3   01 23636.0 0.071871 FALSE
4   01 23665.5 0.081087 FALSE
5   01 33417.5 0.102158 FALSE
6   01 33563.5 0.119645 FALSE
7   01 42929.5 0.175000 FALSE
8   01 44552.5 0.066056 FALSE
9   01 45539.5 0.227691 FALSE
10  01 46984.5 0.649687 FALSE
11  01 47018.0 0.932445 FALSE
12  02 23611.5 1.418377  TRUE
13  02 23667.5 0.474754 FALSE
14  02 46984.0 0.443233 FALSE
15  02 47018.0 0.847738 FALSE
16  02 47051.5 0.446792 FALSE
17  02 47096.5 3.602696 FALSE
18  03 23464.0 1.010199 FALSE
19  03 23523.5 0.150067 FALSE
20  03 23611.5 1.273281  TRUE
21  03 29608.0 0.071324 FALSE...
</code></pre>

<p>There is only one row within each ID-category with is=T. I would like to know a convenient way of calculating the ratio V2 (is=F)/V2 (is=T) within each ID and add the result in a new column/vector with a result like this:</p>

<pre><code>    ID       V1       V2       is         Ratio
1   1   23569.5 0.138996    FALSE   0.10543235
2   1   23611.5 1.318343    TRUE    1
3   1   23636   0.071871    FALSE   0.054516162
4   1   23665.5 0.081087    FALSE   0.061506755
5   1   33417.5 0.102158    FALSE   0.077489697
6   1   33563.5 0.119645    FALSE   0.090754075
7   1   42929.5 0.175000    FALSE   0.132742389
8   1   44552.5 0.066056    FALSE   0.050105322
9   1   45539.5 0.227691    FALSE   0.172709985
10  1   46984.5 0.649687    FALSE   0.492805742
11  1   47018   0.932445    FALSE   0.707285585
12  2   23611.5 1.418377    TRUE    1
13  2   23667.5 0.474754    FALSE   0.334716369
14  2   46984   0.443233    FALSE   0.312493082
15  2   47018   0.847738    FALSE   0.597681716
16  2   47051.5 0.446792    FALSE   0.315002288
17  2   47096.5 3.602696    FALSE   2.540012987
18  3   23464   1.010199    FALSE   0.793382608
19  3   23523.5 0.150067    FALSE   0.117858509
20  3   23611.5 1.273281    TRUE    1
21  3   29608   0.071324    FALSE   0.056015915...
</code></pre>

<p>I am sorry for the trivial question. However my search result has not helped finding the solution I am looking for.</p>