A library of functions for counting the number of times (frequency) that elements occur in an array or matrix.
█ USAGE
Import the Count library.
Create an array or matrix that is a `float`, `int`, `string`, or `bool` type to count elements from, then call the count function on the array or matrix.
The "count map" will return a map with keys for each unique element in the array or matrix, and with respective values representing the number of times the unique element was counted. The keys will be the same type as the array or matrix counted. The values will always be an `int` type.
If an array is in ascending or descending order, then the keys of the map will also generate in the same order.
Include a value to get the count of only that value in an array or matrix.
The string method of count() can use strings or regular expressions like "bull*" to count all matching occurrences in a string array.
To count multiple values, use an array of values instead of a single value. Returning a count map only of elements in the array.
Multiple regex patterns or strings can be counted as well.
An optional comparison operator can be specified to count the number of times an equality was satisfied for `float`, `int`, and `bool` methods of `count()`.
When passing an array of values to count and a comparison operator, the operator will apply to each value.
Multiple comparison operators can be applied when counting multiple values.
Perpustakaan Pine
Dalam semangat TradingView sebenar, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah dikawal selia oleh Peraturan Dalaman.
Penafian
Perpustakaan Pine
Dalam semangat TradingView sebenar, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah dikawal selia oleh Peraturan Dalaman.
