Command to get number of identical entries in a listI have a list from which I want to get the number of times 0's (and 1's) appear in it.
m = {0, 0, 0, 0, 0, 0, 0, 1, 1, 1};nzeros = N Items (m) <1; show (nzeros);
does not seem to work to get the number of times 0 appears in m.
(I get nzeros = 0)
What is the correct way to get the number of times an identical entry appears on a list (I am on JMP 13)?
ScriptingRe: Command to get number of identical entries in a listNames Default to Here( 1 );
m = {0, 0, 0, 0, 0, 0, 0, 1, 1, 1};
mm = Matrix( m );
nZeros = Sum( mm == 0 );
nOnes = Sum( mm == 1 );
Show( nZeros, nOnes );Re: Command to get number of identical entries in a listOk, This works. So I have to convert a list to a Matrix.
Re: Command to get number of identical entries in a listHi @Neo ,
you can try this as well:
Names Default to Here( 1 );
m = {0, 0, 0, 0, 0, 0, 0, 1, 1, 1};
nZeros = n items (loc(m, 0));
nOnes = n items (loc (m, 1));
no conversion to matrix but i do not see any advantage in this case.