[R] sub setting data.frame

Nicolas Gutierrez nicolasg at uw.edu
Mon Feb 28 20:46:59 CET 2011


Hi All,

I have a data.frame:

 >pop

     consumed ind recruits   gonad cell
1    516.74   1     0.02    20.21 0.25
2   1143.20   1     0.02    20.21 0.50
3    250.00   1     0.02    20.21 0.25
4    251.98   1     0.02    18.69 0.25
5    598.08   1     0.02    18.69 0.25
6    437.38   1     0.02    18.69 0.25
7    250.00   1     0.02    17.39 0.25
8    250.00   1     0.02    17.39 0.25
9    250.00   1     0.02    17.39 0.25
10   257.07   1     0.02    16.02 0.25

And I need to get the number of rows that sums a particular value (e.g. 2).

In my case above it would be 4 (the first 4 rows ==> sum(pop$cell)=2.

Any ideas?
THANKS

Nico


-- 

Nicolas L. Gutierrez

School of Aquatic and Fishery Sciences
1122 NE Boat St, Seattle, WA 98105

Lab: 	+1 206 221 5457
Home: 	+1 206 290 3858
www.fish.washington.edu



More information about the R-help mailing list