Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#value_counts(normalize: false, sort: true, ascending: false, dropna: true) ⇒ Hash

Returns a hash that contains the counts of values in hash.

This method treats nil and NaN, the objects who respond true to nan?, as the same thing, and stores the count of them as the value for nil.

Returns:

Parameters:

  • normalize (false, true)

    If true, the result contains the relative frequencies of the unique values.

  • sort (true, false)

    Sort by values.

  • ascending (false, true)

    Sort in ascending order.

  • dropna (true, false)

    Don't include counts of NAs.

Returns:

  • (Hash)

    A hash consists of the counts of the values



2059
2060
2061
2062
2063
# File 'ext/enumerable/statistics/extension/statistics.c', line 2059

static VALUE
hash_value_counts(int argc, VALUE* argv, VALUE hash)
{
  return any_value_counts(argc, argv, hash, hash_value_counts_without_sort);
}