count

count, function

def nosort process count(a: boolean): number

Counts the number of true values in a.

Examples

table T = with
  [| as A, as B |]
  [| true,  "a" |]
  [| true,  "a" |]
  [| true,  "b" |]
  [| false, "b" |]
  [| true,  "c" |]

table G[gdim] = by T.B

show table "Counts" with
  gdim
  count(T.A)
  group by gdim

Output:

gdim count(T.A)
a 2
b 1
c 1
table T = with
  [| as B |]
  [| "a" |]
  [| "a" |]
  [| "b" |]
  [| "b" |]
  [| "c" |]

show scalar "Line count" with count(T.*)

Output: one scalar tile showing 5.

Remarks

T.* is syntactic sugar for true into T and is commonly used with count.

See also

User Contributed Notes
0 notes + add a note