This function tabulates the values in the array and returns a table of counts.

value_counts(x)

Arguments

x

Array or ChunkedArray

Value

A StructArray containing "values" (same type as x) and "counts" Int64.

Examples

cyl_vals <- Array$create(mtcars$cyl) value_counts(cyl_vals)
#> StructArray #> <struct<values: double, counts: int64>> #> -- is_valid: all not null #> -- child 0 type: double #> [ #> 6, #> 4, #> 8 #> ] #> -- child 1 type: int64 #> [ #> 7, #> 11, #> 14 #> ]