I made a table giving me 1's and 2's
In[23]:= S = Join[Table[1, 1], Table[2, 1]]
Out[23]= {1, 2}
And then I made it bigger:
T = RandomChoice[S, 15*365];
And then I separated it:
R = Partition[T, 15];
It looks something like this:
{{2, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1}, {2, 2, 2, 2, 1, 1, 2,
1, 2, 2, 1, 2, 1, 1, 2}, {2, 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2,
2}, {2, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1}, {1, 1, 1, 1, 1,
2, 2, 2, 1, 2, 2, 2, 2, 1, 1}, {2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 2, 1,
1, 1, 1}, {1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1}, {1, 1, 1,
2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2}, {2, 1, 2, 2, 1, 2, 2, 1, 2, 2,
1, 2, 2, 2, 2}, {2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 2, 2, 2, 1, 2}, {1,
2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1}, {1, 1, 2, 1, 2, 1, 2, 2,
1, 2, 1, 1, 2, 1, 2}, {2, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2,
1}, {2, 1, 2, 2, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1}, {2, 2, 1, 1, 1,
1, 2, 2, 1, 2, 1, 1, 2, 1, 1}, {1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 2, 1,
1, 2, 2},
but much bigger. I want to count the number of sublists with more than 9 2's only. Is there anyway to do this? Is there a way to treat the sublists as a separate unit, as opposed to the entire list of R? Thanks.
Tr[UnitStep[Total[R - 1, {2}] - 10]]
will quickly do what you want. $\endgroup$R= RandomChoice[{1,2}, {365,15}];
$\endgroup$