ee.List.frequency

Returns the number of elements in list equal to element.
UsageReturns
List.frequency(element)Integer
ArgumentTypeDetails
this: listList
elementObject

Examples

Code Editor (JavaScript)

// An ee.Image list object.
var list = ee.List([0, 1, 2, 2, 3, 4]);
print('List of integers', list);

// The ee.List.frequency function is used to determine how many times a value is
// present in a list, e.g. what is the frequency of 0, 2, and 9 in the list.
print('Frequency of value 0', list.frequency(0));
print('Frequency of value 2', list.frequency(2));
print('Frequency of value 9', list.frequency(9));