CountsBy
CountsBy[{e1,e2,…},f]
gives an association whose keys are the distinct values of the f[ei], and whose values give the number of times these f[ei] values appear.
Examples
open allclose allBasic Examples (2)
Count the even and odd elements of a list:
Count the prime and composite numbers in a list:
Use the operator form of CountsBy:
Properties & Relations (2)
Wolfram Research (2014), CountsBy, Wolfram Language function, https://reference.wolfram.com/language/ref/CountsBy.html.
Text
Wolfram Research (2014), CountsBy, Wolfram Language function, https://reference.wolfram.com/language/ref/CountsBy.html.
CMS
Wolfram Language. 2014. "CountsBy." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CountsBy.html.
APA
Wolfram Language. (2014). CountsBy. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CountsBy.html